- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
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 create or reset counters with JavaScript?
To create counters, use the counterReset property in JavaScript. You can try to run the following code to create or reset one or more counters with JavaScript −
Example
<!DOCTYPE html> <html> <head> <style> h2:before { counter-increment: section; content: counter(section) " Quiz "; } </style> </head> <body> <h1>Quizzes</h1> <p>Change the counterIncrement</p> <h2>Ruby</h2> <h2 id="myID">Java</h2> <h2>PHP</h2> <h2>Perl</h2> <button onclick="display()">Reset Counter</button> <script> function display() { document.body.style.counterReset = "section"; } </script> </body> </html>
- Related Articles
- How to increment one or more counters with JavaScript?
- How to reset or clear a form using JavaScript?
- How to reset or change the MySQL root password?
- How to reset or clear an edit box in Selenium?
- How to create an Autocomplete with JavaScript?
- Counters in Python?
- Counters in C#
- How to create tabs with CSS and JavaScript?
- How to create a line break with JavaScript?
- How to create a filter table with JavaScript?
- How to create popups with CSS and JavaScript?
- How to create a countdown timer with JavaScript?
- How to create a typing effect with JavaScript?
- How to create a filter list with JavaScript?
- What are Binary Counters?

Advertisements