How can I change the text of a <div> tag after a button is clicked? I've got it to work in a text field, but can't seem to figure out anything with the <div>.
I've tried .write, .innerHTML...no luck.
Printable View
How can I change the text of a <div> tag after a button is clicked? I've got it to work in a text field, but can't seem to figure out anything with the <div>.
I've tried .write, .innerHTML...no luck.
Nevermind. I just used a <span> instead.
It should work for a DIV too by the way:
Code:<p onclick="document.getElementById('div').innerHTML='Hello Mr. Hobo';">Change text</p>
<div id="div">Lalalalalala</div>