If you include 2 version of jQuery in a page how do you restrict a plugin to just one of them?

前端 未结 2 1584
陌清茗
陌清茗 2021-01-06 19:22

So this question isn\'t as crazy as it might sound at first. I\'m developing a piece of javascript code to drop into my client\'s pages. What I\'m worried about is if they

2条回答
  •  梦谈多话
    2021-01-06 19:40

    You could use

    (function($) {        
    
    })(dom);
    

    To wrap you calls.

    This maps dom to $ for just the code within replacing any external $ definition.

    But I am not sure if this works with 2 different jQuery, maybe jQuery cannot coexist with other jQuery versions.

提交回复
热议问题