根据input 单选按钮的是或否来判断显示或隐藏DropDownList

时间:2022-11-10 14:36:48
 
 
 <td style="text-align: right;">是否验证:</td>
                <td style="text-align: left;">
                    <input style="padding-left: 5px;" type="radio" value="1" id="VerifyTrue" name="isVerify" />是
                    <input style="padding-left: 5px;" type="radio" value="0" id="VerifyFalse" name="isVerify" checked="checked" />否
                </td>
<asp:DropDownList ID="dropVote" runat="server" CssClass="input_select_150"></asp:DropDownList>

获取选中value:

var CheckIsVerify = $('input:radio[name="isVerify"]:checked').val();


根据input 单选按钮的是或否来判断显示或隐藏DropDownList


        //点击是否验证触发dropVote显示、隐藏
        var CheckIsVerify = $('input:radio[name="isVerify"]:checked').val();
        $('input:radio[name="isVerify"]').click(function () {
            var isVerify = $('input:radio[name="isVerify"]:checked').val();
            if (isVerify == 1) {
                $("#dropVote").show();
            }
            else { $("#dropVote").hide(); }
        });