Hover Event in jQuery

The hover requires 2 callback functions, one for "mouseover" and another one is far "mouseout".  Thus we can say, hover is an ready made solution that is equivalent of binding these two events in following manner - 

$('.myHoverClassNameComeHere').live('mouseover mouseout', function(event) { 
   if (event.type == 'mouseover') 
       { // do something on mouseover } 
   else 
        { // do something on mouseout } 
});
Note: .live() is deprecated in new versions of jQuery
Instead of writing our own as above, we can simply use jQuery's hover event. The syntax of hover is as-
 
hover (parameter1   ,   parameter2)
                   |                  |________  On Mouse Off
                   |___________   On Mouse Over
 
Lets see it in an example. Suppose we want to get  change a button color when mouse is on over. Say button id is 'btnOk' . So below line of code will do this -
$('#btnOk').hover(  
      function(){ $(this).css('color','blue');   } , 
      function(){ $(this).css('color','green'); }
 );
 
Laughing