I am working on a WordPress website. I have few filters of jQuery in it and all are working fine (I initiate these plugins using):
jQuery(document).ready(function($){
/*code here*/
});
I am also using a jQuery Plugin "filter.js" which is having conflicting issues. Even when I do not initiate this plugin (only on linking the plugin file to my page) it shows jQuery conflict and I can see in console:
Uncaught TypeError: Cannot read property 'fn' of undefined
You can find plugin source here.
I am working on a WordPress website. I have few filters of jQuery in it and all are working fine (I initiate these plugins using):
jQuery(document).ready(function($){
/*code here*/
});
I am also using a jQuery Plugin "filter.js" which is having conflicting issues. Even when I do not initiate this plugin (only on linking the plugin file to my page) it shows jQuery conflict and I can see in console:
Uncaught TypeError: Cannot read property 'fn' of undefined
You can find plugin source here.
Share Improve this question edited Nov 19, 2018 at 22:27 halfer 20.3k19 gold badges109 silver badges202 bronze badges asked Jul 23, 2013 at 18:32 Imran SubhaniImran Subhani 1,1041 gold badge21 silver badges41 bronze badges2 Answers
Reset to default 5Try wrapping your code like this:
(function($){
$(document).ready(function(){
//document ready code here
});
})(jQuery);
Wrap your filter.js plugin with the same wrapper, ie:
(function($){
//filter.js code here
})(jQuery);
If that's not working - make sure jQuery is included on the page.
Are you using two different versions of JQuery in the same page?
If so then use
<script type="text/javascript">
jQuery.noConflict();
</script>
just after the declaring the jQuery and replace all subsequet $ with jQuery
Hope it helps