How do I make the text bold when the button is clicked?

  • 0
    How to make a script so that when the button is clicked, the text inside the button becomes bold?
    JavaScript Anonymous, Jun 4, 2020

  • 2 Answers
  • 0
    btn = document.querySelector(".btn");
    btn.addEventListener('click', function(){
    this.classList.add("bold");
    });




    .bold{
    font-weight: bold;
    }
    Anonymous

  • 0
    Hang up the click event, then add a new class to this class or idi that will have the font-weight bold
    Ava Patel

Your Answer
To place the code, please use CodePen or similar tool. Thanks you!