使用jquery更改功能显示和隐藏值

时间:2013-11-17 12:40:14

标签: c# jquery asp.net

我希望Show()和Hide()关于单击radiobuttonlist的显示。

我设置了一个属性keep-customization =" 1"在表标签中设置。

我写的代码是:

 $("keep-customization").change(function () {
    if ($(this).is(":checked").val() == "")
    {
        example(".textgrid").has("input[keep-current-customization='false']").show();
    }
    else {
        example(".textgrid").has("input[keep-current-customization='false']").hide();
    }
});

我在源上查看radiobuttonlist的页面是:

                            保留您当前的电话号码(必填)

                    <div class="desc">
                         Will you be keeping your current phone number?</div>
                    <br />


<div class="textgrid">
                                <div class="feildset1">
                                    <span id="rptCustomization_rptItems_6_ctl00_0" style="display:none;"><strong style="color:Red;">Required.</strong></span><table id="rptCustomization_rptItems_6_ctrl_0" keep-customization="1">
    <tr>
        <td><input id="rptCustomization_rptItems_6_ctrl_0_0_0" type="radio" name="rptCustomization$ctl06$rptItems$ctl00$ctrl" value="43" /><label for="rptCustomization_rptItems_6_ctrl_0_0_0">Y</label></td>
    </tr><tr>
        <td><input id="rptCustomization_rptItems_6_ctrl_0_1_0" type="radio" name="rptCustomization$ctl06$rptItems$ctl00$ctrl" value="44" /><label for="rptCustomization_rptItems_6_ctrl_0_1_0">N</label></td>
    </tr>
</table>
                                    <br />
                                </div>
                            </div>

将在radiobuttonlist的更改中显示和隐藏的div是:

<div class="textgrid">
                                <div class="feildset1">
                                    Account holders name on your current phone bill?: </br><input name="rptCustomization$ctl07$rptItems$ctl00$ctrl" type="text" maxlength="100" id="rptCustomization_rptItems_7_ctrl_0" keep-current-customization="false" /></br>
                                    <br />
                                </div>
                            </div>

                            <div class="textgrid">
                                <div class="feildset1">
                                    Current phone company you have?: </br><input name="rptCustomization$ctl07$rptItems$ctl01$ctrl" type="text" maxlength="100" id="rptCustomization_rptItems_7_ctrl_1" keep-current-customization="false" /></br>
                                    <br />
                                </div>
                            </div>

                            <div class="textgrid">
                                <div class="feildset1">
                                    What is the account # with your current provider?: </br><input name="rptCustomization$ctl07$rptItems$ctl02$ctrl" type="text" maxlength="100" id="rptCustomization_rptItems_7_ctrl_2" keep-current-customization="false" /></br>
                                    <br />
                                </div>
                            </div>

                            <div class="textgrid">
                                <div class="feildset1">
                                    What is the PIN/access code for current provider?: </br><input name="rptCustomization$ctl07$rptItems$ctl03$ctrl" type="text" maxlength="100" id="rptCustomization_rptItems_7_ctrl_3" keep-current-customization="false" /></br>
                                    <br />
                                </div>
                            </div>

                            <div class="textgrid">
                                <div class="feildset1">
                                    What are the two nearest cross streets?: </br><input name="rptCustomization$ctl07$rptItems$ctl04$ctrl" type="text" maxlength="100" id="rptCustomization_rptItems_7_ctrl_4" keep-current-customization="false" /></br>
                                    <br />
                                </div>
                            </div>

1 个答案:

答案 0 :(得分:0)

您无法创建自己的html属性,例如“keep-customization”。您也无法处理表的更改事件,因为它不存在。

尝试为课程更改它。并将事件绑定到单选按钮。