Change HTML text on button click | Calling javascript variable in html

Sometime we need to change HTML elements or any text on click event in javascript. Here we'll see how to change the text in html on click of button.

When user clicks on button changeText() function executed.

We can change the text using id which should be unique at particular HTML page.

We also can do the same through the class name property.

 

Share This:

Leave a Reply

Your email address will not be published. Required fields are marked *