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?
相关问题
- Views base64 encoded blob in HTML with PHP
- Is there a limit to how many levels you can nest i
- How to toggle on Order in ReactJS
- void before promise syntax
- Keeping track of variable instances
You can do it with regular JavaScript this way:
Here is the doc for getElementById and the innerHTML property.
The
innerHTML
property description:Try:
You may try the following:
You can use this:
document.getElementById('h1_id').innerHTML = 'the new text';