开发者

is there a way to run a JQuery function even the DOMs are not yet loaded

im thinking if there is a way to ru开发者_开发问答n a jquery function like $.post even if the DOM's are not yet loaded..


Yes, if you place your script after jQuery has been loaded, you are free to execute any jQuery functions. However, DOM manipulation will, of course, be unreliable if you're outside of a $(document).ready() block or similar.


Yes you can, once jquery has loaded.

function checkJquery(){
    if(typeof($)==undefined){
        setTimeout(checkJquery,500);
    } else {
        start();
    }
}
setTimeout(checkJquery,500);

Then write your code in start().

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜