Home>Article>Web Front-end> How to set jquery to stop for a few seconds
In jquery, you can use the setTimeout() method to set a few seconds to stop before executing. This method is used to set a specified waiting time. When the time is up, a specified code will be executed. Syntax is "setTimeout(code to be executed, number of milliseconds to stop)".
The operating environment of this tutorial: windows10 system, jquery3.2.1 version, Dell G3 computer.
setTimeout() is a method belonging to window. This method is used to call a function or calculate an expression after the specified number of milliseconds
Syntax The format can be the following two:
setTimeout(要执行的代码, 等待的毫秒数) setTimeout(JavaScript 函数, 等待的毫秒数)
setTimeout() is to set a specified waiting time (unit is one thousandth of a second, millisecond). When the time is up, the browser will execute a specified code
Examples are as follows:
这是标题
这是一个段落。
这是一个段落。
这是一个段落。
Output results:
Related video tutorial recommendations:jQuery video tutorial
The above is the detailed content of How to set jquery to stop for a few seconds. For more information, please follow other related articles on the PHP Chinese website!