'innerHTML' Example : innerHTML « Node Operation « JavaScript DHTML






'innerHTML' Example

  
    
<html>
<body>
<p id="myP">Sample Text inside a <b>p</b> element</p>
<button onclick="alert(myP.innerHTML);">InnerHTML</button>
<button onclick="alert(myP.innerText);">InnerText</button>
</body>
</html>

    
      
        
    
  








Related examples in the same category

1.Get the paragraph tag and set its innerHTML value
2.Switch html with assigning the innerHTML
3.Modifying Elements after Page loads