实现的需求就是单选按钮点击取消,在数据加载以后执行,写的方法就是 $().ready(function(){ //do something })this
$().ready(function(){
$("input:radio").click(function(){
var checkedState = $(this).attr('checked');//记录当前选中状态
console.log(checkedState)
$(this).attr('checked',true);//2.
if(checkedState == 'checked'){
$(this).attr('checked',false); //3.
}
});
})复制代码