Javascript DOM HTML Ol type Property set

Introduction

Set the ordered list to use lowercase alphabetical letters:

document.getElementById("myOl").type = "a";

Click the button to set the ordered list to use lowercase alphabetical letters.

View in separate window

<!DOCTYPE html>
<html>
<body>

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

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

<script>
function myFunction() {
  document.getElementById("myOl").type = "a";
}
</script>

</body>
</html>

The type property sets or gets the value of the type attribute of an ordered list.

The type attribute sets the type of marker for the list, for example letters or numbers.

Property Values

Value Description
1 Default. Decimal numbers (1, 2, 3, 4)
a Alphabetically ordered list, lowercase (a, b, c, d)
A Alphabetically ordered list, uppercase (A, B, C, D)
i Roman numbers, lowercase (i, ii, iii, iv)
I Roman numbers, uppercase (I, II, III, IV)

The type property return a String representing the kind of marker used in the ordered list.




PreviousNext

Related