Li value Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Li


The value property sets or gets the value attribute of a list item, which 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>.

Set the value property with the following Values

Value Description
number Sets the value of the list item

Return Value

A Number, representing the value of the list item

The following code shows how to Set the list items to increment from the number "200":

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>

  <li id="myLi" value="100">CSS</li>
</ol>//from w  w w  . jav a 2s  . com

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

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

function myFunction() {
    document.getElementById("myLi").value = 100;


Related Tutorials