天天看点

jQuery关于radio的取值与赋值

取radio的值:

   $('input:radio:checked').val();

   $("input[type='radio']:checked").val();

   $("input[name='radioName']:checked").val();

   $("input[name='radioName'][checked]").val();

给radio 赋值, 选中值为test的radio:

   $("input[name='radioName'][value=test]").attr("checked",true);

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/12060579/viewspace-2076885/,如需转载,请注明出处,否则将追究法律责任。

转载于:http://blog.itpub.net/12060579/viewspace-2076885/

继续阅读