Javascript examples for DOM HTML Element:Li
You can create a <li> element by using the document.createElement() method:
<!DOCTYPE html> <html> <body> <ol id="myList"> <li>SQL</li> <li>HTML</li> <li>XML</li> </ol>// w w w .ja v a 2s . c om <button onclick="myFunction()">create a LI element</button> <p id="demo"></p> <script> function myFunction() { var x = document.createElement("LI"); var t = document.createTextNode("CSS"); x.appendChild(t); document.getElementById("myList").appendChild(x); } </script> </body> </html>