Example
Set the list items to increment from the number "200":
document.getElementById("myLi").value = "200";
Try it Yourself »
Definition and Usage
The value property sets or returns the value of 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.
Note: The value must be a number and can only be used in ordered lists (<ol>).
Browser Support
The value property is supported in all major browsers.
Syntax
Return the value property:
liObject.value
Set the value property:
liObject.value=number
Property Values
Value | Description |
---|---|
number | Specifies the value of the list item |
Technical Details
Return Value: | A Number, representing the value of the list item |
---|
More Examples
Example
Return the value of a list item:
var x = document.getElementById("myLi").value;
The result of x will be:
100
Try it Yourself »
Related Pages
HTML reference: HTML <li> value attribute
< Li Object