ProAnswers.org

how I can change the contents with innerHTML in javasript?

Changing Text with innerHTML

Each HTML element has an innerHTML property that defines both the HTML code and the text that occurs between that element's opening and closing tag. By changing an element's innerHTML after some user interaction, you can make much more interactive pages.



However, using innerHTML requires some preparation if you want to be able to use it easily and reliably. First, you must give the element you wish to change an [id](http://www.tizag.com/cssT/cssid.php). With that id in place you will be able to use the getElementById function, which works on all browsers.



After you have that set up you can manipulate the text of an element.



JavaScript Code:

Welcome to the site dude