Ol reversed Property - Javascript DOM HTML Element

Javascript examples for DOM HTML Element:Ol

Description

The reversed property sets or gets whether the list order should be descending.

Set the reversed property with the following Values

Value Description
true|false Sets whether the list order should be descending

Return Value

A Boolean, returns true if the list order is descending, otherwise it returns false

The following code shows how to Set the list order to descending:

Demo Code

ResultView the demo in separate window

<!DOCTYPE html>
<html>
<body>

<ol id="myOl">
  <li>A</li>
  <li>B</li>
  <li>C</li>
  <li>D</li>
  <li>E</li>
</ol>/*w w  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>

Related Tutorials