Created
May 15, 2014 10:10
-
-
Save carlosrojaso/f0db9c38bdc009bbfc81 to your computer and use it in GitHub Desktop.
JQuery Putting jQuery Into No-Conflict Mode
This file contains hidden or 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
<!-- Putting jQuery into no-conflict mode. --> | |
<script src="prototype.js"></script> | |
<script src="jquery.js"></script> | |
<script> | |
var $j = jQuery.noConflict(); | |
// $j is now an alias to the jQuery function; creating the new alias is optional. | |
$j(document).ready(function() { | |
$j( "div" ).hide(); | |
}); | |
// The $ variable now has the prototype meaning, which is a shortcut for | |
// document.getElementById(). mainDiv below is a DOM element, not a jQuery object. | |
window.onload = function() { | |
var mainDiv = $( "main" ); | |
} | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment