JavaScript set the label text | Simple example code

Use the innerHTML property to change or set the text inside the label in JavaScript. The innerHTML property sets or returns the HTML content of an element.

JavaScript set label text Example

You can change or set the text of a label using JavaScript. Here is the HTML example code on click button label text will be changed by the function.

Output:

JavaScript set the label text example

Do comment if you have any doubts and suggestion on this basic Examples of JS.

Note: All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version


Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.