Change the Value of h1 Element within a Form with JavaScript


I have two forms on an HTML5 page. Each form has a name and an id. The second form has an h1 element, which also has a name and an id. How do I change the text of this h1 element on the second form using plain JavaScript?

This question is tagged with javascript html dom getelementbyid

~ Asked on 2012-03-02 07:03:11

The Best Answer is



document.getElementById("yourH1_element_Id").innerHTML = "yourTextHere";

~ Answered on 2012-03-02 07:06:27


You can use this: document.getElementById('h1_id').innerHTML = 'the new text';

~ Answered on 2012-03-02 07:05:47

Most Viewed Questions: