- Trending Categories
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
jQuery clearQueue() with Examples
The clearQueue() method in jQuery is used to remove all items from the queue.
Syntax
The syntax is as follows −
$(selector).clearQueue(queue)
Above, the queue is the name of the queue.
Example
Let us now see an example to implement the jQuery clearQueue() method −
<!DOCTYPE html> <html> <head> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script> <script> $(document).ready(function(){ $(".button1").click(function(){ var div = $("div"); div.animate({height: 250}, "slow"); div.animate({left: "+=200",top: "+=100" }, "slow"); $("span").text(div.queue().length); }); $(".button2").click(function(){ $("div").clearQueue(); }); }); </script> <style> div { width:100px; height:100px; position:absolute; left:10px; top:100px; background-color:orange; } </style> </head> <body> <button class="button1">Start</button> <button class="button2">End</button> <p>Length = <span></span></p> <div></div> </body> </html>
Output
This will produce the following output −
Above, click “Start” to begin the animation −
Now, you can also press “Stop” to stop the animation anywhere in between −
- Related Articles
- jQuery remove() with Examples
- jQuery dequeue() with Examples
- jQuery detach() with Examples
- jQuery stop() with Examples
- jQuery siblings() with Examples
- jQuery slideUp() with Examples
- jQuery queue() with Examples
- jQuery delay() with Examples
- jQuery hide() with Examples
- jQuery replaceWith() with Examples
- jQuery position() with Examples
- jQuery prop() with Examples
- jQuery ready() with Examples
- jQuery replaceAll() with Examples
- jQuery load() with Examples

Advertisements