Create <UL> and <LI> and add <LI> to <UL> element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Ul

Description

Create <UL> and <LI> and add <LI> to <UL> element

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <div id="output"> 
      </div> 
      <script type="text/javascript">
var _ul = document.createElement('ul');
var _li=  document.createElement('li');
_li.innerHTML="Something";
_ul.appendChild(_li);
document.getElementById("output").appendChild(_ul)

      </script>  
   </body>/*from ww w  .  ja va  2  s .c  o m*/
</html>

Related Tutorials