Li valueProperty

Li 对象参考手册Li Object

Example

Set the list item to start incrementing 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; subsequent list items will start incrementing from that number.

Note:The value must be a number and can only be used in an ordered list (<ol>).


Browser Support

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value attribute.


Syntax

Return the value property:

liObject.value

Set the value property:

liObject.value=number

Property Values

Value Description
number Specifies the value of a list item.

Technical Details

Return value: A number, representing the value of a list item.


More Examples

Example

Return the value of a list item:

var x = document.getElementById("myLi").value;

xThe result is:

100

Try it Yourself »


Related Articles

HTML Reference Manual:HTML <li> value Attribute


Li 对象参考手册Li Object

Other Extensions