具有一定值的jquery检查单选按钮

时间:2013-10-02 11:54:18

标签: jquery radio-button

我想,我在这里犯了一个简单的错误:

$('.myRadioButtons').val('3121').attr("checked",true);

但是这个也不行:

$(':input[value="3121"]').attr("checked",true);

同样的问题也是“prop”而不是“attr”。

谢谢..

编辑:这是在线:http://jsfiddle.net/WWC4G/1/

1 个答案:

答案 0 :(得分:3)

尝试使用以下

$('input[value="3121"]').prop("checked",true)

  or

$('input[value="3121"]').attr("checked","checked")
相关问题