关于jquery在页面初始化时radio控件选定默认值的问题

网上找了很多资料,都是比较旧版本的方法,新版的jquery都已经抛弃了。

正确的代码是

$('input:radio[name="statusRadios"][value="normal"]').prop('checked', true);
$('input:radio[name=statusRadios]').filter('[value=banned]').prop('checked', true);  //这个也可以

 

如果还使用了jquery的uniform插件,那么还需要增加一句

$.uniform.update();

 

完整的就是

	$('input:radio[name="statusRadios"][value="normal"]').prop('checked', true);
	//$('input:radio[name=statusRadios]').filter('[value=banned]').prop('checked', true);  //这个也可以
	$.uniform.update();

  

原文地址:https://www.cnblogs.com/zsxfbj/p/jquery_set_radio_checked.html