jQuery delay()

jQuery delay() method is used to set a timer to delay execution of subsequent items in the queue.

Below the syntax of jquery delay() method

.delay(duration[,queueName])

    • duration
    • Type: Integer
    • An integer indicating the number of milliseconds to delay execution of the next item in the queue.

    • queueName
    • Type: String
    • A string containing the name of the queue. Defaults to fx, the standard effects queue.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery delay()</title>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script>
$(document).ready(function() {
  $("#delay").click(function() {
     $("div").delay("slow").fadeIn();
  });
});
</script>
</head>
<body>
 <button style="margin:0 0 10px 0" class="btn" id="delay">click me</button><br />
 <div style="display:none;background:#11a286;height:120px;width:120px;position:absolute;"></div>
 </body>
</html>