"TypeError: $ (...) null" What is happening?

Firebug reports an error:

TypeError: $(...) is null $('#menu img').hover( 

I have no idea why. Apparently the problematic script is the one that replaces the image when the cursor hovers over the image:

 $(document).ready(function() { var storeNormalPath; $('#menu img').hover( function() { storeNormalPath = $(this).attr('src'); var imgArray = $(this).attr('src').split('.jpg'); $(this).attr('src', imgArray[0]+'Hover.jpg'); }, function() { $(this).attr('src', storeNormalPath); } ).click (function() { //empty now }); }); 
+4
source share
1 answer

After some viewing your page using the chrome console, it looks like even $(document) returns null. However, jQuery(document) works, which indicates a conflict with the jQuery $ operator.

(Source: I would point you to this question: $. Document null )

Seeing that the page title is like jquery-1.5.1.min.js and jquery.1.4.2.js , maybe this could be the cause of the conflict? Did you try to download only one of them?

Let us know if this helps, sorry, I could not help anymore. Good luck

+4
source

All Articles