The Li object represents an HTML <li> element.
We can access a <li> element via document.getElementById()
:
var x = document.getElementById("myLi");
Click the button to set the list items to increment from the number "300" instead of "1".
<!DOCTYPE html> <html> <body> <ol> <li id="myLi">CSS</li> <li>HTML</li> <li>Java</li> <li>Javascript</li> </ol>//from ww w . j av a 2s. co m <button onclick="myFunction()">Test</button> <script> function myFunction() { var x = document.getElementById("myLi"); x.value = "300"; } </script> </body> </html>