Li value Property - Return the value of a list item: - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Li

Description

Li value Property - Return the value of a list item:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<ol>
  <li id="myLi" value="100">A</li>
  <li>B</li>
  <li>C</li>
</ol>/*from ww  w .  ja va2  s.  c  o  m*/

<button onclick="myFunction()">Test</button>

<p id="demo"></p>

<script>
function myFunction() {
    var x = document.getElementById("myLi").value;
    document.getElementById("demo").innerHTML = x;
}
</script>

</body>
</html>

Related Tutorials