To add or remove a class on hover using jQuery you can use the snippet below.

Adding a Class

See this JSFiddle for adding a CSS-Class.

$('#test1').hover(function(){  $(this).addClass('hoverClass');});

Removing a Class

See this JSFiddle for removing a CSS-Class.

$('#test1').hover(function(){  $(this).removeClass('hoverClass');});

14 thought on “How to add or remove a class on hover using jQuery”

Leave a Reply