Reputation: 2660
I want to add class "active" in existing jQuery code I'm not quite good in jQuery I try but I'm not lucky enough.
i want to add class "active" for active state
I have a sample here
$(function() {
$('#arrow').click(function() {
$('.toggleContent').slideToggle('fast');
return false;
});
});
Upvotes: 0
Views: 78
Reputation: 298056
To add it to the arrow that was clicked, use $(this)
:
$('#arrow').click(function(event) {
$('.toggleContent').slideToggle('fast');
$(this).toggleClass('active');
event.preventDefault();
});
Upvotes: 3