YouTip LogoYouTip

Prop Li Value

HTML DOM Li value Property

HTML DOM Li value Property

-- Learning is not just about technology, but also about dreams!

JavaScript Reference

Overview

JavaScript Objects

Browser Objects

DOM Objects

HTML Objects

Li value Property

Li Object Reference 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 property sets the value for a list item, and subsequent 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

Internet ExplorerFirefoxOperaGoogle ChromeSafari

All major browsers support the value property.


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 output of x will be:

100

Try it yourself Β»


Related Articles

HTML Reference: HTML <li> value Attribute


Li Object Reference Li Object

← Dom Obj MeterDom Obj Li β†’