jQuery hover executed twice

Recently been using jQuery a lots for effect and for the awesome DOM manipulation. I found there is a small problem with this code:

$("#myButton").hover(function() {  
  // my hover function  
}

The function get executed when mouse over the button, but when mouse is leaving the button, it get executed again, quick fix:

$("#myButton").hover(function() {  
  // my hover function  
, function() {});

Just adding in the an empty function after that seems to fix the problem.

May 31, 2011 ยท Stephen Saw