Do something once jQuery plugin has loaded

后端 未结 3 1539
不知归路
不知归路 2021-01-18 13:11

I\'m dynamically loading jQuery and jQuery UI into a page, and I need to know when jQuery UI has successfully extended jQuery

3条回答
  •  Happy的楠姐
    2021-01-18 13:40

    I used this code on some project to ensure that some scripts run sequentially. It did not work on IE (and I didn't have time to debug), but worked fine on everything else.

    var node = document.createElement("script");
    $.extend(node, {
        type: 'text/javascript',
        charset: 'utf-8',
        async: false,
        defer: true,
        src: /*...*/
    });
    $(node).bind('load', loadedCallback);
    $('head')[0].appendChild(node);
    

提交回复
热议问题