The regular way to keep jQuery compatible to other frameworks is to override the $-Function with the following code:
jQuery.noConflict();
jQuery(document).ready(function() {
jQuery("someelement").dosomething();
});
or
$j = jQuery.noConflict();
$j(document).ready(function() {
$j("someelement").dosomething();
});
but is there also a way to keep additional jquery-plugins compatible without changing the whole $-Function-Signs like above?
Thanks in advance!
Danny
The
jQueryobject is passed as argument to thereadyhandler, so you can do:Regarding plugins: They should only access the global
jQueryelement anyway, to exactly avoid these kinds of compatibility issues.Most plugins are defined as
If they are not, then they are designed badly. If you have such a plugin, you should write the author of it to fix it. You’d have to change the source and wrap the whole code inside this function to make it work.