jQuery Error: ‘g is undefined’

×

This post was originally published in 2009
It may contain stale & outdated information. Or it may have grown more awesome with age, like the author.

Discovered the cause of this annoying (but seemingly impotent) error in a response by Karl Swedberg on Nabble.

The error was caused by my passing only one function to jQuery.hover(), eg:

 jQuery(".blog-entry-date").hover(function(){
                jQuery(this).animate({color: genHex()},100);
        });

Hover takes two functions. Instead ‘mouseenter’ should be used:

 jQuery(".blog-entry-date").bind('mouseenter',function(){
                jQuery(this).animate({color: genHex()},100);
        });

The error didn’t seem to have any effect on the execution of the code (at least in Firefox), but errors are errors, and the the cause should be hunted down. Always.

Comments (45) | Trackback