'$' of object [object Window] is not a function

Just discovered an issue with the sorting plugin used on our cart, was working fine yesterday, and no changes have been made to it. The site is located here. I realize there is a mess of javascript and jquery in the HEAD, and I am sure that is not helping matters. The error I'm getting is Property '$' of object [object Window] is not a function. Is there possibly a jQuery conflict going on here?

Answers


Rap any Javascript code in a closure,

(function($){
    // code goes here
})(jQuery);

This will then prevent any problems with jQuery and the use of the $ as what your doing is creating a function that takes in the $ as a name, this then forces every thing inside closure will use the function local copy of $


kiranvj vcsjones both had the right idea about what to tackle first. We have one of those badges on there that was trying to append a string when it was expected a number, hence the Nan error. Fixed that, but still getting the error. I haven't uploaded my changes as this site takes a while, but I did fix the NaN eror, but still have the original problem.


You can also change the jquery variable with the noConflict method.

<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript">
 var J=$.noConflict();
 J(".class").hide(); //use J instead of $ now
</script>

That way you KNOW it's not a jquery conflict with the $ character


another contributing factor to your issue is your loading both jquery and jqueryui twice.


Need Your Help

Use Spider to duplicate Federation Tables on different Hosts

mysql mariadb

How can I use Create Table on a Spider node to use Spider as a HA solution for Federation tables. I want all queries to be duplicated on both servers.

Overlay VideoView but keep touch focus on underlying activities in Android

java android

I'm trying to create an app that will display a video in a VideoView in a transparent activity but keep the touch focus on any underlying activity. For example, if I have one app opened and my app is