1.

What is the purpose of JQuery's delay() method? Can you use this for different types of browsers like (Internet Explorer)?

Answer»

The delay() method is used to set the delay between two events, such as a click or a change in state. The delay can be set to a number of different values, including milliseconds, seconds, and even hours. This can be useful when you want to wait for an event to occur before doing something else. 

For example - you could use a delay of 5 minutes to wait for a user to click on your button before moving on to the next step in your workflow.

Although the delay() method is not available in all browsers. In order to use it in Internet Explorer, you will need to add the following line of code:

window.addEventListener('click', function() { delay(5000); });

But the latest Microsoft browser (Microsoft Edge) that replaces the internet explorer has support for the jQuery delay() method.

In addition, the delay() method is not available in some browsers, such as Firefox and Safari. To work around this issue, you can use the setTimeout() method instead.




Discussion

No Comment Found