javascript - What does each of the following codes in a HTML file mean? -
<button type="button" onclick="document.getelementbyid('msg').innerhtml = 'gone!'"> click me!</button> <button type="button" onclick="document.getelementbyid('msg').innerhtml = 'back again!'"> bring me back!</button>
can explain each line means?
on click of buttons search element id="msg" , set inner html i.e. content of element.
https://jsfiddle.net/night11/qs3sl6qt/1/
<p id="msg">my first paragraph</p> <button type="button" onclick="document.getelementbyid('msg').innerhtml = 'gone!'"> click me!</button> <button type="button" onclick="document.getelementbyid('msg').innerhtml = 'back again!'"> bring me back!</button>
Comments
Post a Comment