How to resolve jQuery conflicts

  • Many JavaScript libraries use $ as a function or variable name, just as jQuery does. In jQuery's case, $ is just an alias for jQuery, so all functionality is available without using $.

    • Run $.noConflict() method to give control of the $ variable back to whichever library first implemented it. This helps to make sure that jQuery doesn't conflict with the $ object of other libraries.

    noConflict examples
    • Below are four examples of using jQuery noConflict(). The scripts on the left side of the page are all the same. On the right side are the modified scripts with additions/substitutions shown in red. noConflict examplesnoConflict examples
Share on Google Plus

About quora Questions & Answers A-Z

This is a short description in the author block about the author. You edit it by entering text in the "Biographical Info" field in the user admin panel.
    Blogger Comment
    Facebook Comment

0 comments:

Post a Comment