I’ve used jQuery for some months with good results, but today I’m facing something weird. This is my code:
<script type="text/javascript" src="js/jquery-1.6.1.min.js"></script>
Following code works fine in another page of the same project (I myself did it some months ago):
$(hideButtonJQId).click(function (){
$(this).hide("slow", function (){
... do something
});
});
For some reason, in the new page, hide is only working without parameters:
$(hideButtonJQId).click(function (){
$(this).hide();
});
If I try to set any parameter, even just a delay parameter, it throws errors:
$(hideButtonJQId).click(function (){
$(this).hide(1000);
$(this).hide('slow');
$(this).hide('slow', function{ alert('not working'); });
etc.
});
The error in FireBug is “c.replace is not a function“.
We’re using YUI framework in both pages, the one where it works fine, and the one where it doesn’t. I’ve thought it could be a crash between frameworks but the error message I’m getting from FireBug comes from jquery-1.6.1.min.js file. I would really appreciate any suggestion.
This issue is about libraries collisions. If you face similar problems, you may refer following references to use compatibility mode and jQuery plugins authoring.
Plugins Authoring
Using_jQuery_with_Other_Libraries
In the beginning, I thought it wasn’t a collision issue due to error was thrown from jQuery’s JS file, but I guess that the very first invocation was done to the other library’s JS file that in the end finished being executed in jQuery. In the case of Internet Explorer, it showed the error in a different JS file, that was the way I realize the fix.
I hope it helps, kind regards to everyone.