gpt4 book ai didi

asp.net-mvc - 单选按钮更改事件

转载 作者:行者123 更新时间:2023-12-01 18:03:32 24 4
gpt4 key购买 nike

我有 2 个单选按钮。(例如:ID 和名称)..

  <%=Html.RadioButton("Emp","1")%>
<label>ID</label>
<%=Html.RadioButton("Emp","2")%>
<label>Name</label>

如果我点击名称,

<p>
<%:Html.LabelFor(m => m.MyDate)%>:&nbsp;
<%:Html.EditorFor(m => m.MyDate) %>
</p>

上面的控件应该是可见的 false..如何做到这一点。

最佳答案

$(':radio[value=2]').click(function() {
// Might need to adjust the selector here based
// on the field you would like to hide
$('#MyDate').hide();
});

或者如果您想使用.change()事件:

$(':radio[name=Emp]').change(function() {
// read the value of the selected radio
var value = $(this).val();
if (value == '2') {
$('#MyDate').hide();
}
});

关于asp.net-mvc - 单选按钮更改事件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4202799/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com