Tuesday, September 25, 2012

JQuery conflicts with other libraries

JQuery conflicts with other libraries


When JQuery conflicts with other libraries follow this steps in the following code:


1- Attach jquery library:

<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>

2- Attatch the other library (such as “Prototype”):

<script src="lib-path/prototype.js" type="text/javascript"></script>

3- Replace JQuery start symbol “$” with other by using “noConflict” JQuery function:

<script type="text/javascript">
var $j = jQuery.noConflict();
// Use jQuery via $j(...)
$j(document).ready(function(){
$j("#divstart").click(function() {
$j(".content").fadeOut(100);
return false;
});
});
</script>

Thanks,,

No comments: