Hover Event in jQuery


 jQuery is very powerful as it says write less and do more....
We can get done our two job in its single 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'); }
                      );


Share on Google Plus

About Unknown

0 comments :

Post a Comment