1:单选框,直接定位到属性名称
$(document).ready(function(){
var old = null; //用来保存原来的对象
$("input[name='sex']").each(function(){//循环绑定事件
if(this.checked){
this.checked= false;
}else{
this.checked = true;
}
});
});
2.根据iD
function select_input(hid){
jQuery("#"+hid).each(function(){//循环绑定事件
if(this.checked){
this.checked = false;
}else{
this.checked = true;
}
});
}