Get Ol Element - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Ol

Introduction

The Ol object represents an HTML <ol> element.

You can access an <ol> element by using getElementById():

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<ol id="myOl">
  <li>CSS</li>
  <li>HTML</li>
  <li>SQL</li>
</ol>/*  w w w .ja v a  2  s  .com*/

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

<script>
function myFunction() {
    var x = document.getElementById("myOl");
    x.start = "2";
}
</script>

</body>
</html>

Related Tutorials