Javascript DOM HTML Ol reversed Property get

Introduction

Find out if the list order is descending or not:

var x = document.getElementById("myOl").reversed;

Click the button to find out if the list order is descending or not.

View in separate window

<!DOCTYPE html>
<html>
<body>

<ol id="myOl">
  <li>CSS</li>
  <li>HTML</li>
  <li>Java</li>
  <li>Javascript</li>
  <li>SQL</li>
</ol>/*ww  w .  j  a  v  a 2 s  .c o  m*/

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

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

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

</body>
</html>



PreviousNext

Related