Get Ul Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Ul


The Ul object represents an HTML <ul> element.

You can access a <ul> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

<ul id="myUL">
</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>

function myFunction() {
    var x = document.getElementById("myUL").id;
    document.getElementById("demo").innerHTML = x;


Related Tutorials