Javascript DOM Element InnerHTML

Description

Javascript DOM Element InnerHTML

View in separate window


<html>
<head>
<title>getElementById() + innerHTML Example</title>
</head>//from w  w  w.  j av a  2 s .  c om

<body>
  <div id="helloWorldDiv"></div>
  <script>
    
    let myDivRef = document.getElementById("helloWorldDiv");
    myDivRef.innerHTML = "<h1>Hello World!</h1>";

  </script>
</body>
</html>



PreviousNext

Related