Home >>jQuery Tutorial >jQuery queue() Method

jQuery queue() Method

jQuery queue() Method

jQuery queue() method in jQuery is a built-in mechanism that is used to execute the specified items and displays the task list. You can execute one or more functions in the queue.

Syntax:
$(selector).queue(queueName)

Parameter Values

Parameter Description
queueName It is optional parameter used to specifies the queue name This parameter default value is "fx", the standard effects queue
Here is an Example of jQuery queue() Method:

<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(".btn1").click(function(){
var div = $("#box1");
div.animate({height: 100}, "slow");
div.animate({width: 100}, "slow");
div.animate({height: 50}, "slow");
div.animate({width: 50}, "slow");
});
});
</script>
</head>
<body>
<button class="btn1">Start</button>
<div id="box1" style="width:50px;height:50px;position:absolute;left:10px;top:50px;background-color:green;"></div>
</body>
</html> 

Output: