How do I make the text bold when the button is clicked?
-
How to make a script so that when the button is clicked, the text inside the button becomes bold?JavaScript Anonymous, Jun 4, 2020
-
btn = document.querySelector(".btn");
btn.addEventListener('click', function(){
this.classList.add("bold");
});
.bold{
font-weight: bold;
}Anonymous -
Hang up the click event, then add a new class to this class or idi that will have the font-weight boldAva Patel
2 Answers
Your Answer
To place the code, please use CodePen or similar tool. Thanks you!