jQuery queue() with Examples

The queue() method in jQuery is used to display the queue of functions to be executed on the selected elements.


The syntax is as follows −


Above, the parameter queue is the name of the queue.


Let us now see an example to implement the jQuery queue() method 

 Live Demo

<!DOCTYPE html>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
         var div = $("div");
         div.animate({height: 250}, "slow");
         div.animate({left: "+=200",top: "+=100" }, "slow");
div {
<p>Length = <span></span></p>


This will produce the following output −

Now, click the “Begin” button to animate and get the length of the queue -