Private archive copy · Unofficial site · Content copyright belongs to Runoob Tutorial and the original authors · View Original

HTML DOM Li value property

Li value property

Li Object Reference Li Object

Example

Set the list item to increment starting from the number "200":

document.getElementById("myLi").value="200";

Try it »


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 of a list item, and subsequent list items will increment starting from that number.

Note: The value must be a number and can only be used in an ordered list (

    ).


    Browser support

    Internet ExplorerFirefoxOperaGoogle ChromeSafari

    All major browsers support the value attribute.


    Syntax

    Return the value attribute:

    liObject

    .value

    Set the value attribute:

    liObject

    .value=

    number

    Attribute values

    Value Description
    number Specifies the value of the list item.

    Technical Details

    Return Value: Number, representing the value of the list item.

    More examples

    Example

    Return the value of a list item:

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

    x The output is:

    100

    Try it »


    Related Articles

    HTML Reference Manual:HTML

  1. value attribute


    Li Object Reference Li Object