Javascript DOM HTML Ol start Property get

Introduction

Return the value of the first list item in the ordered list:

var x = document.getElementById("myOl").start;

Click the button to return the value of the start attribute of the ordered list.

View in separate window

<!DOCTYPE html>
<html>
<body>

<ol id="myOl" start="50">
  <li>CSS</li>
  <li>HTML</li>
  <li>Java</li>
</ol>//from w w  w  .j a va2 s . c o  m

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

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

</body>
</html>



PreviousNext

Related