How to set listStyleImage, listStylePosition, and listStyleType in one declaration with JavaScript?

To set the list properties in a single declaration, use the listStyle property in JavaScript.


You can try to run the following code to set the listStylePosition and listStyleType property in one declaration with JavaScript −

Live Demo

<!DOCTYPE html>
      <ol id="myID">
      <button type="button" onclick="display()">Change style</button>
         function display() {
            document.getElementById("myID").style.listStyle = "circle outside";

Sharon Christine
Sharon Christine

An investment in knowledge pays the best interest

Updated on: 23-Jun-2020


Kickstart Your Career

Get certified by completing the course

Get Started