Javascript DOM HTML Ol start Property set

Introduction

Set the start value of the ordered list to "42":

document.getElementById("myOl").start = "42";

Click the button to set the start value of the ordered list to "42", instead of "1".

View in separate window

<!DOCTYPE html>
<html>
<body>

<ol id="myOl">
  <li>CSS</li>
  <li>HTML</li>
  <li>Java</li>
</ol>//  w  w w .ja v a  2s . c o  m
<button onclick="myFunction()">Test</button>

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

</body>
</html>

The start property sets or gets the value of the start attribute of an ordered list.

The start attribute sets the start value of the first list item in an ordered list.

Value Description
number Specifies the start value of the first item in the ordered list

The start property return a Number representing the start value of the first list item in the ordered list.




PreviousNext

Related