如果单选按钮的形式检查

如果单选按钮的形式检查

本文介绍了如何decollapse部分,如果单选按钮的形式检查的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我简单的想知道如何瓦解一个div部分象下面这样一个单选按钮被选中时,

I simple want to know how to collapse a div section when a radiobutton like below is checked

单选框,我要检查,以折叠部分

Radiobutton that I want checked to collapse a section

<div>
    @Html.RadioButtonFor(model => model.Transaction.PaymentProvider, "2")
    @Html.LabelFor(model => model.Transaction.PaymentProvider, "Pay with Credit Card")
</div>

部分,我想崩溃,如果单选框上述被检查

Section that I wanted collapse if Radiobutton above is checked

<div class="panel-body">
    <table border="0" cellspacing="0" cellpadding="0" align="middle">
        <tr>
            <td width="100" border="0" class="paylabel">Card Number:</td>
            <td colspan="3" width="335" border="0" class="paylabel">
                <div class="editor-field">
                    @Html.EditorFor(model => model.Transaction.CreditCard.CardNumber)
                    @Html.ValidationMessageFor(model => model.Transaction.CreditCard.CardNumber)
                </div>
            </td>
        </tr>
    </table>
</div>

我使用的引导,并试图手风琴类,但只适用于一个超链接,我不知道如何做一个条件,如果该单选按钮被选中,那么decollapse

I am using bootstrap and tried the accordion classes but that only works with a hyperlink and I'm not sure how to make a condition if that radiobutton is checked then decollapse

<label class="radio">
<input checked="checked" data-val="true" data-val-number="The field PaymentProvider must be a number." data-val-required="The PaymentProvider field is required." id="Transaction_PaymentProvider" name="Transaction.PaymentProvider" type="radio" value="1"/>
<label for="Transaction_PaymentProvider">Pay with PayPal</label>
 <input id="Transaction_PaymentProvider" name="Transaction.PaymentProvider" type="radio" value="2" />
<label for="Transaction_PaymentProvider">Pay with Credit Card</label>
 </label>

这是正在从IE浏览器调试的code

this is the code that is being debugged from IE

推荐答案

使用从这里的信息jQuery Click事件单选按钮不被解雇

$("input[name=Transaction_PaymentProvider]").click(function(){
    if($('input:radio[name=Transaction_PaymentProvider]:checked').val() == "2"){
        $('.panel-body').show();
    }else{
        $('.panel-body').hide();
    }
}

您需要看什么名字的单选按钮生成。我不记得这个名字会做。要么 _。 http://api.jquery.com/show/ 和的去了方法,你可以自定义的效果。希望这有助于。

You will need to look at what name is generated for the radio button. I don't remember if the name will be . or _. http://api.jquery.com/show/ and http://api.jquery.com/hide/ go over ways you can customize the effect. Hopefully this helps.

这篇关于如何decollapse部分,如果单选按钮的形式检查的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-22 23:03