How to set the list-item marker type with JavaScript?

To set the type of the list-item marker type, use the listStyleType property. The marker type can be square, circle, dic, etc.


You can try to run the following code to set the list-item marker type with JavaScript −

Live Demo

<!DOCTYPE html>
      <ul id="myID">
      <button type="button" onclick="displaySquare()">Update list style type (square)</button>
      <button type="button" onclick="displayDecimal()">Update list style type (decimal)</button>
         function displaySquare() {
            document.getElementById("myID").style.listStyleType = "square";
         function displayDecimal() {
            document.getElementById("myID").style.listStyleType = "decimal";

Updated on: 23-Jun-2020


Kickstart Your Career

Get certified by completing the course

Get Started