Jquery plugins occupy the same function name -> conflict

后端 未结 3 968
遥遥无期
遥遥无期 2021-01-02 01:56

I\'ve ran into a problem using jquery expose plugin alongside Masked Input plugin. The problem is they both occupy $.mask function which leads to conflict. But

3条回答
  •  一个人的身影
    2021-01-02 02:15

    I think I agree with mu's answer. One addition might be to use jQuery.sub().

    Since most plugins use the jQuery global during construction, you should be able to alias jQuery before loading one of the plugins. Then you could re-alias afterwards to whatever you choose.

     
    
    
    
    

    The only possible advantage to this approach is that it might isolate one plugin from the changes that another plugin might make to jQuery methods. It's slightly convoluted but the only alternative to altering the plugins, that I can think of.

提交回复
热议问题