radio 点击选中再点不选中

Html代码:

      

<input type="radio" id="radiobutton" name="radiobutton"  value="0"  onclick="changeStyle()">

 JS代码:

  

function changeStyle(){
	if($("#radiobutton").val()==1){
		$("#radiobutton").attr("value","0");
		$("#radiobutton").removeAttr("checked");
	} else {
		$("#radiobutton").val("1");
		$("#radiobutton").attr("checked","checked");
	}
}

猜你喜欢

转载自jccmjl.iteye.com/blog/1703668
今日推荐