Avoiding Conflicts with Other Libraries | jQuery Learning Center

PHOTO EMBED

Sat Jan 29 2022 00:13:43 GMT+0000 (UTC)

Saved by @lizziesnyc #jquery

<!-- 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>
content_copyCOPY

https://learn.jquery.com/using-jquery-core/avoid-conflicts-other-libraries/