Why are the delay method in JQuery?

0 votes
Ethan Karla asked 28-Jul-2021 in Web Application by Ethan Karla

Why are the delay method in JQuery?

1 Answer

1 votes
Ravi Vishwakarma answered 29-Jul-2021 by Ravi Vishwakarma

jQuery delay()

 Jquery is used to end a task late and if a task is in progress, then it works to stop it for some time. In other words, it is done to start some work late.


$(selector).delay (speed)
$(selector).delay (speed, queueName)

Speed and queueName is an optional parameter. Speed specifies the delay of showing elements these possible vales are 'slow', 'fast' and milliseconds. 

<!DOCTYPE html>

    <script src='https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js'></script>
        $(document).ready(function () {
            $('button').click(function () {
        main {
        div {
            width: 150px;
            height: 150px;
            display: none;
    <button>Click me</button>
        <div id='div1' style='background-color: red;'></div>
    <div id='div2' style='background-color: green;'></div>
    <div id='div3' style='background-color: blue;'></div>
    <div id='div4' style='background-color: pink;'></div>
    <div id='div5' style='background-color: navy;'></div>

Why are the delay method in JQuery?