Simultaneous use of multiple jQuery version conflict (different frame using the $ symbol, covering the use of first use, and lead to conflict)

Using jquery and other frameworks, have experienced less $ to write, time to do more, there will be conflict

solution:
1. Release of the right to use $
  • Release "$" the right to use: jQuery.noConflict ();
  • Precautions: release operation must be written before writing the other jQuery code
    can not use the "$" after the release, only use "jQuery"
2. Customize a symbolic visit
  • Access a custom symbol: var nj = jQuery.noConflict (); release $ symbol used instead nj
<script>
    var nj = jQuery.noConflict();
    nj(function () {
        alert("hello jq1")
    })
</script>

Guess you like

Origin blog.csdn.net/Cao_Mary/article/details/90519835