Created
October 6, 2011 10:48
-
-
Save pete-otaqui/1267113 to your computer and use it in GitHub Desktop.
Multiple jQueries have different Events
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Multiple jQuery Hell</title> | |
<script src="jquery-1.6.3.min.js"></script> | |
<script> | |
// keep a reference to jQuery 1.6.3, and clear the name from the global scope | |
jQuery163 = jQuery; | |
jQuery.noConflict(true); | |
</script> | |
<script src="jquery-1.6.4.min.js"></script> | |
<script> | |
// keep a reference to jQuery 1.6.4, and clear the name from the global scope | |
jQuery164 = jQuery; | |
jQuery.noConflict(true); | |
</script> | |
<script> | |
// check that we have two distinct jQueries | |
console.log(jQuery163().jquery); // 1.6.3 | |
console.log(jQuery164().jquery); // 1.6.4 | |
// we could use either for the onDomReady bit ... | |
jQuery163(function() { | |
// bind a click event callback | |
jQuery163('a').bind('click', function() { | |
console.log('clicky!'); | |
}); | |
// now try and unbind it | |
jQuery164('a').unbind('click'); // this doesn't unbind the click event callback | |
}); | |
</script> | |
</head> | |
<body> | |
<h1>Multiple jQuery Hell</h1> | |
<a href="#">Clicky</a> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment