JavaScript :- what is an inner html.

  • The innerHTML property can be used to write the dynamic html content on the html document.
  • The innerHTML property sets or returns the HTML content (inner HTML) of an element.

<!DOCTYPE html> 
<html> 
 
<head> 
 <meta name="viewport" content="width=device-width, initial-scale=1"> 
</head> 
 
<body> 
 
 <div id="t_div">Old Text</div> 
 
 <button type="button" onclick="set_html();">Change HTML</button> 
 
 <script> 
  function set_html() 
  { 
   document.getElementById("t_div").innerHTML = "<b>New Text</b>"; 
  } 
 </script> 
 
</body> 
 
</html>

JavaScript :- what is an inner html. JavaScript :- what is an inner html. Reviewed by Network security on May 30, 2019 Rating: 5

1 comment:

  1. Thank you for sharing your thoughts and knowledge on this topic. This is really helpful and informative, as this gave me more insight to create more ideas and solutions for my plan. I would love to see more updates from you.

    Melbourne Web Developer

    ReplyDelete

Useful Information

Powered by Blogger.