jQuery Tutorial

jQuery clearQueue() Method With Syntax & Example

Understanding clearQueue method in jQuery

The clearQueue() method clears the queue of all items that haven't been run yet. It's worth noting that it keeps running once a function is started until it's finished.

Similar methods:

  • Queue () - Displays the functions that have been queued.

  • Dequeue () - Removes the following function from the queue before executing it.

The clearQueue() method, unlike the stop() method (which only works with animation), can erase any queued functions.

Syntax for clearQueue in jQuery

$(selector).clearQueue(queueName)

Example of jQuery clearQueue

Stop the functions in the queue that are still running:

$("button").click(function(){
  $("div").clearQueue();
});
Did you find this article helpful?