Avoid jQuery conflict with Other JavaScript library(prototype,YUI,mootools)
In this jQuery article, I will explain how to avoid jquery conflict with other javascript libraries.
javascript libraries such as YUI, prototype conflict with Jquery library as prototype library also uses `$` sign.To resolve this issue, jQuery has .noConflict() method.
.noConflict() method: Relinquish jQuery's control of the $ variable (override the $ function)
we can avoid prototype and jquery conflict using .noConflict() method.
Example:Avoid jQuery conflict with Other JavaScript library
<html>
<title>Avoid conflict between JQuery and prototype,YUI,mootools (Other javascript Libraries)</title>
<head>
<script src="/js/prototype.js"></script>
<script src="/js/jquery.js"></script>
<script type="text/javascript" src="../other_lib.js"></script>
<script language="javascript" type="text/javascript">
jQuery.noConflict();
jQuery(document).ready(function(){
jQuery("#t1").show();
// Do something with jQuery
});
$('t1').show();
// Do something with prototype
</script>
</head>
</html>
You can now Avoid jQuery conflict with Other JavaScript library using the above code.
I hope,this example will help you to
Avoid jQuery conflict with Other JavaScript library.