Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery addClass and Remove Class on hover

Okay i would like to add a class cfse_a to an element #searchput when the mouse is hovering over the element and then when the mouse is not hovering over the element then remove class cfse_a.

like image 620
user1405690 Avatar asked May 22 '12 17:05

user1405690


1 Answers

Use hover event with addClass and removeClass methods:

$("#searchput").hover(function() {
    $(this).addClass("cfse_a");
}, function() {
    $(this).removeClass("cfse_a");
});

DEMO: http://jsfiddle.net/G23EA/

like image 92
VisioN Avatar answered Sep 23 '22 22:09

VisioN