JqueryNo Comments

default thumbnail

How to toggle a class onclick the element in jquery

Add Class

$("button").click(function(){        
$("div").addClass('active');   
})

Remove Class

$("button").click(function(){        
$("div").removeClass('active');   
})

Toggle Class

$("button").click(function(){        
$("div").toggleClass('active');   
})

Be the first to post a comment.

Add a comment