Get Li Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Li

Introduction

The Li object represents an HTML <li> element.

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

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<ol>
  <li id="myLi">CSS</li>
  <li>SQL</li>
  <li>HTML</li>
  <li>XML</li>
</ol>//from   w w w  . j a  va2 s  . c o  m

<button onclick="myFunction()">set the list items to increment from the number "3" instead of "1"</button>

<script>
function myFunction() {
    var x = document.getElementById("myLi");
    x.value = "3";
}
</script>

</body>
</html>

Related Tutorials