Prevent jQuery multiple reference

后端 未结 3 2090
时光说笑
时光说笑 2021-01-06 17:45

I am developing DNN modules and I am using jQuery in some modules, I add the jQuery reference to the top of each ascx file, by the way when user add multiple modules to the

3条回答
  •  甜味超标
    2021-01-06 18:00

    If you're loading jQuery in a high-conflict environment, try namespacing jQuery.

    SOMETHING = {
        jQuery: jQuery,
        $: $
    }
    

    And then call jQuery via SOMETHING.$ or SOMETHING.jQuery. Just remember to do the namespacing as soon as the version of jQuery you want has loaded, or else you'll end up with the wrong one. If you have access to the jQuery file, the easiest way to do this is to append the namespacing code at the end of the file.

提交回复
热议问题