我有一个按钮,通过点击另一个按钮触发.我想延迟点击第二个按钮两秒钟.我使用.delay()但它没有用.
jq(function() {
jq('a.box').click(function() {
jq(this).closest('.button').find('.add_this').delay(2000).click();
})
});
Run Code Online (Sandbox Code Playgroud)
或者使用setTimeout;
jq(function() {
jq('a.box').click(function() {
setTimeout(function(){
jq(this).closest('.button').find('.add_this').click();
},800);
});
});
Run Code Online (Sandbox Code Playgroud)
但没有奏效.