Skip to content Skip to sidebar Skip to footer

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 o

Solution 1:

Try:


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


Solution 2:

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


Solution 3:

document.getElementById("myh1id").innerHTML = "my text"

Solution 4:

You may try the following:

document.getElementById("your_h1_id").innerHTML = "your new text here"

Solution 5:

You can also use this

document.querySelector('yourId').innerHTML = 'Content';

Post a Comment for "Change The Value Of H1 Element Within A Form With JavaScript"