- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
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.
Example
You can try to run the following code to set the list-item marker type with JavaScript −
<!DOCTYPE html> <html> <body> <ul id="myID"> <li>One</li> <li>Two</li> </ul> <button type="button" onclick="displaySquare()">Update list style type (square)</button> <button type="button" onclick="displayDecimal()">Update list style type (decimal)</button> <script> function displaySquare() { document.getElementById("myID").style.listStyleType = "square"; } function displayDecimal() { document.getElementById("myID").style.listStyleType = "decimal"; } </script> </body> </html>
Advertisements