【发布时间】:2015-10-12 12:34:50
【问题描述】:
我有两个单选按钮代表真假。当我选择 false 时,我想隐藏 orderaddress1 标签和文本框。我用jquery 好像不行
这是我的单选按钮视图:
<div class="delivery">
<div class="form-group">
@Html.LabelFor(model => model.DeliveryChoice, "DeliveryChoice", new { @class = "control-label col-md-2" })
<div class="col-md-10">
<div>
<label>@Html.RadioButton("DeliveryChoice", true) Deliver my order to me</label>
</div>
<div>
<label>@Html.RadioButton("DeliveryChoice", false) I will pick up my order</label>
</div>
</div>
</div>
</div>
文本框和标签视图:
<div class="Add1">
<div class="form-group ">
@Html.LabelFor(model => model.OrderAdress1, new { @class = "control-label col-md-2" })
<div class="col-md-10">
@Html.EditorFor(model => model.OrderAdress1, new { htmlAttributes = new { @class = "box" } })
@Html.ValidationMessageFor(model => model.OrderAdress1)
</div>
</div>
</div>
jquery:
<script>
$(document).ready(function(){
$('#radio_button').click(function () {
if ($("input[name='name']:checked").val() == false)
$('.Add1').hide();
});
});
</script>
【问题讨论】:
标签: jquery asp.net-mvc asp.net-mvc-5