简体   繁体   English

验证活动的手风琴面板

[英]Validate active accordion panel

I have a bootstrap 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)? 但是如何禁用无效选项卡中的输入(在上述情况下为PayPal)? Thanks! 谢谢!

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 显示的内容具有类.in,因此将其取反,您将获得隐藏的手风琴琴体

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM