Li value Property
Example
Set the list items to increment from the number "200":
document.getElementById("myLi").value = "200";
Try it Yourself »
Description
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
Property | |||||
---|---|---|---|---|---|
value | Yes | Yes | Yes | Yes | Yes |
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;
Try it Yourself »
Related Pages
HTML reference: HTML <li> value attribute
❮ Li Object