Desynchronizing Jquery
I have a recursive function being called before a .click handler (this checks to see if radio buttons are checked). It's preventing my .click from executing. And if I switch them, my recursive function doesn't e开发者_运维知识库xecute. Is there some way to desynchronize the execution of Jquery script so i can check to see if my checkboxes are checked AND run my recursive function?
In general, is there a standard way of doing this? Right now I'm running all my code in the header of the document, should I split them up can load the scripts separately with the html-script tag?
You can use the setTimeout()
to execute a function asynchronously. For example,
function delay() {
alert('world');
}
setTimeout(delay, 100);
alert('hello');
The snippet above will alert the user "hello", and after 100ms, it will alert the user "world".
精彩评论