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

Popular posts from this blog

wordpress - (T_ENDFOREACH) php error -

Export Excel workseet into txt file using vba - (text and numbers with formulas) -

Using django-mptt to get only the categories that have items -