Javascript 我们有不止一个选择。这是一个asp.netcheckboxlist@user2664298我根据你的评论补充了我的答案。希望这就是你现在正在寻找的。我实际上有5个选项,这是一个多选复选框列表,所以RadioButtonList根本不适合。所以我有五个选择,
Javascript 我们有不止一个选择。这是一个asp.netcheckboxlist@user2664298我根据你的评论补充了我的答案。希望这就是你现在正在寻找的。我实际上有5个选项,这是一个多选复选框列表,所以RadioButtonList根本不适合。所以我有五个选择,,javascript,jquery,asp.net,checkboxlist,Javascript,Jquery,Asp.net,Checkboxlist,我们有不止一个选择。这是一个asp.netcheckboxlist@user2664298我根据你的评论补充了我的答案。希望这就是你现在正在寻找的。我实际上有5个选项,这是一个多选复选框列表,所以RadioButtonList根本不适合。所以我有五个选择,其中两个是未知的,没有。因此,如果选择了“未知”或“无”,则其他四个选项将被禁用。否则,用户可以选择多个选项。这是一个asp.netcheckboxlist@user2664298我根据你的评论补充了我的答案。希望这就是您现在正在寻找的内容。我
我们有不止一个选择。这是一个asp.netcheckboxlist@user2664298我根据你的评论补充了我的答案。希望这就是你现在正在寻找的。我实际上有5个选项,这是一个多选复选框列表,所以RadioButtonList根本不适合。所以我有五个选择,其中两个是未知的,没有。因此,如果选择了“未知”或“无”,则其他四个选项将被禁用。否则,用户可以选择多个选项。这是一个asp.netcheckboxlist@user2664298我根据你的评论补充了我的答案。希望这就是您现在正在寻找的内容。我已经尝试了这个$('lsExposureValue input:checkbox')。单击(函数(){var currentId=$(this.attr('id');$('lsExposureValue input:checkbox')。每个(函数(){if($(this.attr('id')!=currentId){$(this.attr('checked',false)} }); }); 一次短期暴露中期暴露未知你检查小提琴了吗?我觉得你的代码很好。您已将此添加到文档中。准备好了吗?尝试使用以下选项:短期暴露中期暴露未知和$('lsExposureValue input')。单击(函数(){var$that=$(this);$('lsExposureValue input')。每个(函数(){if($(this)!=$that){$(this).attr(“checked”,false);}});我尝试了这个$('lsExposureValue输入:复选框')。单击(函数(){var currentId=$(this.attr('id');$('lsExposureValue输入:复选框')。每个(函数(){if($(this.attr('id')!=currentId){$(this.attr('checked',false)});一次短期暴露中期暴露未知你检查小提琴了吗?我觉得你的代码很好。您已将此添加到文档中。准备好了吗?尝试使用以下选项:短期暴露中期暴露未知和$('lsExposureValue input')。单击(函数(){var$that=$(this);$('lsExposureValue input')。每个(函数(){if($(this)!=$that){$(this).attr(“checked”,false);}});
foreach (ListItem li in chk_mycheckbox.Items)
{
if ((!(li.Text.ToString().Contains("Unknown"))))
{
li.Enabled = false;
}
}
<li><input type="radio" name="gender" value="male">Male</li>
<li><input type="radio" name="gender" value="female">Female</li>
$('input[type=checkbox]').each(function () {
if(!$(this).is(':checked')){
//if not checked
$(this).prop('disabled', true);
}
});
$(document).ready(function() {
$('#formId input.single-selection').on('click', function (e) {
var selectedCheckbox = $(this);
if(selectedCheckbox.is(':checked')){
$('#formId input[type=checkbox]').each(function () {
if(selectedCheckbox[0] != $(this)[0]){
//if not selected checkbox
$(this).prop('disabled', true);
$(this).attr('checked', false);
}
});
}else{
$('#formId input[type=checkbox]').prop('disabled', false);
}
});
});
<input type='checkbox' >A
<input type='checkbox' >B
<input type='checkbox' >C
<input type='checkbox' >D
<script>
var checked = false; //will save current state of checkboxes
$('input:checkbox').click(function(){
//if one was checked and then unchecked will enable all and return
if(checked)
{
$('input:checkbox').each(function(){
$(this).prop('disabled', false);
});
checked = false;
return;
}
//if none was checked before, disable the rest
$('input:checkbox').each(function(){
if(!$(this).is(':checked')){
$(this).prop('disabled', true);
}
else
checked = true;
});
});
</script>
$('#form1 input').on('click',function(evt){
var clickedEl = evt.target;
if(clickedEl.checked){
$('#form1 input').each(function(){
$(this).attr('disabled',true);
});
$(clickedEl).attr('disabled',false);
}
else{
$('#form1 input').each(function(){
$(this).attr('disabled',false);
});
}
});
$('.myCheckBox').click(function(){
var currentId = $(this).attr('id');
$('.myCheckBox').each(function(){
if($(this).attr('id') != currentId){
$(this).attr("checked", false);
}
});
});
$('#YourID input:checkbox').click(function(){
var currentId = $(this).attr('id');
$('#YourID input:checkbox').each(function(){
if($(this).attr('id') != currentId){
$(this).attr("checked", false);
}
});
});
<ul>
<li><input type="checkbox" name="gender" value="male">Male</li>
<li><input type="checkbox" name="gender" value="female">Female</li>
</ul>
$('input').change(function(){
if( $(this).prop('checked') ){
$(this).parent().parent().find('input').prop('disabled', true);
$(this).prop('disabled', false);
}
});
$(document).ready(function () {
var checked = false;
$('#<%=lstExposureValue.ClientID%> input:checkbox').click(function () {
var currentIdone = 'Unknown';
var currentId = $(this).next().html();
if (currentId == currentIdone) {
if (checked) {
$("#<%=lstExposureValue.ClientID%> input").removeAttr('disabled');
checked = false;
return;
}
else {
$("#<%=lstExposureValue.ClientID%> input").attr('checked', false);
$(this).attr('checked', true);
$('#<%=lstExposureValue.ClientID%> input:not(:checked)').attr('disabled', 'disabled');
checked = true;
}
}
});
});