How Can I remove Conflict in my Jquery?

后端 未结 1 1899
我在风中等你
我在风中等你 2021-01-16 03:26

I am new to JQuery And I have used 2 jQueries in my page.

For first JQuery my script is like this:



        
1条回答
  •  無奈伤痛
    2021-01-16 04:05

    It is your 2nd jQuery script you should be performing $.noConflict() on.

    If you do;

    
    
    
    

    Both jQuery and $ will point to jQuery 1.4, and nothing will refer to jQuery 1.7. Incidentally, if you were to run $.noConflict again after loading jQuery 1.4, jQuery would reference 1.4, but $ would be undefined.

    However, if you do:

    
    
    
    

    The $ will refer to jQuery 1.7, but the jQuery will point to jQuery 1.4 (as will your jq variable).

    You may want to look at the $.noConflict(true); which releases both the jQuery and $ variables; so you can do something like this;

    
    
    
    

    Then both the $ and jQuery will point to jQuery 1.7, and only your jq variable will point to jQuery 1.4

    0 讨论(0)
提交回复
热议问题