XTRUST.ORG
XTRUST.ORG

Reputation: 3402

Validate active accordion panel

I have a bootstrap accordion:

Accordion

And I want to disable all input controls in inactive panels. To validate just active panel.

I have a function to detect active tab:

$(".panel").on("show.bs.collapse hide.bs.collapse", function(e) {
    if (e.type=='show'){
        console.log($(this));

    } else {

    }
});

But how to disable inputs in inactive tabs (PayPal in the case above)? Thanks!

Upvotes: 0

Views: 680

Answers (1)

JGM
JGM

Reputation: 83

try something like this:

$('.accordion-body:not(.in) > .input-for-paypal').prop('disabled', true)

the content that is shown has the class .in, so negate it and you get the hidden accordion-body

Upvotes: 1

Related Questions