3 回答
TA贡献1772条经验 获得超6个赞
$(document).ready(function () {
$('#RadioButtonList1 input').change(function () {
debugger;
if ($(this).val() == 1) {
$('#TextBox_ArrivalDate').attr("enabled", "enabled");
} else {
$('#TextBox_ArrivalDate').attr("disabled", "disabled");
}
});
});
TA贡献1804条经验 获得超3个赞
希望我的片段可以在任何方面帮助你。祝你今天过得愉快!
<html>
<head>
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(function() {
$("[name=trip]").change(function() {
var st = $("[name=trip]:checked").val();
if (st == "1") {
$("#TextBox_ArrivalDate").prop('disabled', false);
} else {
$("#TextBox_ArrivalDate").prop('disabled', true);
}
});
})
</script>
</head>
<body>
<input type="radio" name="trip" value="1" checked> roundtrip<br>
<input type="radio" name="trip" value="0"> one way<br>
<input type="text" id="TextBox_ArrivalDate">
</body>
</html>
TA贡献1804条经验 获得超8个赞
改变这一行
$("#RadioButtonList1").change(function() 到 $("<%= RadioButtonList1.ClientID %>").change(function()。
ASP.Net 以不同的格式呈现 RadioButton ID。您可以使用此语法在客户端访问单选按钮的 id。
添加回答
举报