Huginn
Huginn

Reputation: 230

Active / Inactive states

I'm looking to add an inactive state to an accordion title that isn't labeled with the class "active".

$(".accordion-section-title").click(function() {
  if (!$(".accordion-section-title").hasClass('active')) {
    $(".accordion-section-title").toggleClass("inactive");
  }
});

Upvotes: 0

Views: 422

Answers (1)

Eshu
Eshu

Reputation: 359

May be below code will help you out:

$(".accordion-section-title").click(function(evt) {
        $(".accordion-section-title").removeClass('active').addClass('inactive');
        $(evt.currentTarget).addClass('active');
});

Please let me know if you still face any issue.

Upvotes: 1

Related Questions