Javascript examples for DOM HTML Element:Ul
The Ul object represents an HTML <ul> element.
You can access a <ul> element by using getElementById():
<!DOCTYPE html> <html> <body> <ul id="myUL"> <li>CSS</li> <li>Javascript</li> <li>HTML</li> </ul>//from w ww.ja va 2 s. co m <button onclick="myFunction()">get the id of the unordered list</button> <p id="demo"></p> <script> function myFunction() { var x = document.getElementById("myUL").id; document.getElementById("demo").innerHTML = x; } </script> </body> </html>