Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/70.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/powerbi/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
jQuery-将超时设置为3秒,然后运行函数_Jquery - Fatal编程技术网

jQuery-将超时设置为3秒,然后运行函数

jQuery-将超时设置为3秒,然后运行函数,jquery,Jquery,有没有办法使用jQuery?将超时设置为3秒,然后在不需要计时器插件的情况下运行函数?有没有办法使用jQuery?当然对于jQuery 1.4及更高版本,您可以使用: 否则,如果没有jQuery库,您可以按照我的同事的建议使用setTimeOut(doSomething(),毫秒)。当然可以。这不需要jQuery function myfunc() { alert('run'); } setTimeout( myfunc, 3000 ); // call "myfunc&quo

有没有办法使用jQuery?将超时设置为3秒,然后在不需要计时器插件的情况下运行函数?

有没有办法使用jQuery?当然对于jQuery 1.4及更高版本,您可以使用:

否则,如果没有jQuery库,您可以按照我的同事的建议使用
setTimeOut(doSomething(),毫秒)

当然可以。这不需要jQuery

function myfunc() {
   alert('run');
}

setTimeout( myfunc, 3000 ); // call "myfunc" after 3 seconds

如果这不是您想要的,则需要更多信息。

只需使用本机JavaScript即可:

我投票关闭,因为我觉得这必须是一个翻版。谢谢,我使用了您的解决方案
function myfunc() {
   alert('run');
}

setTimeout( myfunc, 3000 ); // call "myfunc" after 3 seconds