jquery实现html中单选按钮的切换选中
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>damo</title>
</head>
<script src="jquery.js"></script>
<body>
<input type="radio" class="radio" checked="checked" name="radio" value='1'>男
<br/>
<input type="radio" class="radio" name="radio" value='0'>女
</body>
<script >
$('.radio').click(function(){
if( $(this).val()=='1'){
$(this).attr('checked',false);
$(this).val('0');
}else{
$(this).val('1');
}
//其他兄弟节点值为0
$(this).siblings().val('0');
})
</script>
</html>