下面是一些检查单选按钮是否被禁用的代码。如果 radio 当前被禁用,我该如何对此进行修改以使 radio 不受检查?是的,我仍然想删除父 CSS 类。谢谢。
$('input:disabled', true).parent().removeClass("style1");
为什么这不起作用?
$('input:disabled', true).attr('checked', false).parent().removeClass("style1");
最佳答案
How do I reform this to make the radio unchecked if it is currently disabled?
你可以这样做:
$(':radio').each(function(){
if ($(this).is(':disabled')) {
$(this).attr('checked', false);
}
});
更多信息:
关于jquery - 如何使用 jQuery 取消选中禁用的单选按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3377626/