
- HTML Tutorial
- HTML - Home
- HTML - Overview
- HTML - Basic Tags
- HTML - Elements
- HTML - Attributes
- HTML - Formatting
- HTML - Phrase Tags
- HTML - Meta Tags
- HTML - Comments
- HTML - Images
- HTML - Tables
- HTML - Lists
- HTML - Text Links
- HTML - Image Links
- HTML - Email Links
- HTML - Frames
- HTML - Iframes
- HTML - Blocks
- HTML - Backgrounds
- HTML - Colors
- HTML - Fonts
- HTML - Forms
- HTML - Embed Multimedia
- HTML - Marquees
- HTML - Header
- HTML - Style Sheet
- HTML - Javascript
- HTML - Layouts
- HTML References
- HTML - Tags Reference
- HTML - Attributes Reference
- HTML - Events Reference
- HTML - Fonts Reference
- HTML - ASCII Codes
- ASCII Table Lookup
- HTML - Color Names
- HTML - Entities
- HTML - Fonts Ref
- HTML - Events Ref
- MIME Media Types
- HTML - URL Encoding
- Language ISO Codes
- HTML - Character Encodings
- HTML - Deprecated Tags
HTML DOM li value Property
The Li value property returns/sets the value of the value attribute of a <li> element.
Syntax
Following is the syntax −
- Returning value of the <li> value attribute
liObject.value
- Value of the <li> attribute value set
liObject.value = ‘string’
Let us see an example for Li value property −
Example
<!DOCTYPE html> <html> <head> <title>HTML DOM value</title> <style> form { width:70%; margin: 0 auto; text-align: center; } * { padding: 2px; margin:5px; } input[type="button"] { border-radius: 10px; } ol{ width: 30%; margin: 0 auto; } </style> </head> <body> <form> <fieldset> <legend>HTML-DOM-value</legend> <h3>Race Result</h3> <ol id="race"> <li>Alex</li> <li>Eden</li> <li>Samuel</li> <li>Zampa</li> </ol> <input type="button" onclick="rectifyResult()" value="Alex Cheated"> <div id="divDisplay"></div> </fieldset> </form> <script> var divDisplay = document.getElementById("divDisplay"); var studentList = document.getElementsByTagName("li"); var race = document.getElementById("race"); function rectifyResult() { studentList[1].value = '1'; studentList[2].value = '2'; studentList[3].value = '3'; race.removeChild(studentList[0]) divDisplay.textContent = 'Alex is disqualified'; } </script> </body> </html>
Output
This will produce the following output −
Before clicking ‘Alex Cheated’ button −
After checking ‘What exams are in this week?’ button −
- Related Articles
- HTML DOM li Object
- HTML DOM value Property
- HTML DOM Meter value Property
- HTML DOM Button value Property
- HTML DOM Select value Property
- HTML DOM Option value Property
- HTML DOM Input Time value Property
- HTML DOM Input URL value Property
- HTML DOM Input Week value Property
- HTML DOM Input Number value Property
- HTML DOM Input Reset value property
- HTML DOM Input Search value property
- HTML DOM Input Submit value Property
- HTML DOM Input Password value property
- HTML DOM Input Radio value Property

Advertisements