HTMLOListElement: type property
Baseline Widely available
This feature is well established and works across many devices and browser versions. It’s been available across browsers since July 2015.
The type
property of the HTMLOListElement
interface indicates the kind of marker to be used to display ordered list.
It reflects the type
attribute of the <ol>
element.
Note: The type
can be defined in CSS with the list-style-type
property. The list-style-type
property provides many more values.
Value
A string representing the type.
Its possible values are listed in the attribute marker types section.
Examples
HTML
html
<ol id="order-list">
<li>Fee</li>
<li>Fi</li>
<li>Fo</li>
<li>Fum</li>
</ol>
JavaScript
js
const olElement = document.querySelector("#order-list");
// if type is not specified then return empty string
console.log(olElement.type); // Output: ""
olElement.type = "i"; // Using roman numeral type
console.log(olElement.type); // Output: "i"
Result
Specifications
Specification |
---|
HTML Standard # dom-ol-type |
Browser compatibility
BCD tables only load in the browser