Javascript DOM HTML Li value Property set

Introduction

Set the list items to increment from the number "200":

document.getElementById("myLi").value = "200";

Click the button to set the list items to increment from the number "200" from "1".

View in separate window

<!DOCTYPE html>
<html>
<body>

<ol>
  <li id="myLi">CSS</li>
  <li>HTML</li>
  <li>Java</li>
  <li>Javascript</li>
  <li>SQL</li>
  <li>C++</li>
</ol>//from  w  w w .  j  a  v  a2  s . c o m

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

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

</body>
</html>

The value property sets or gets the value attribute of a list item.

The value attribute sets the value of a list item, and the following list items will increment from that number.

The value must be a number and can only be used in ordered lists <ol>.

The value property accepts and returns a number type value.

Value Description
number Specifies the value of the list item



PreviousNext

Related