Check if a radio button is checked jquery

This question already has an answer here:

  • Check if checkbox is checked with jQuery 19 answers

  • 尝试这个

    if($('input:radio:checked').length > 0){
    // go on with script
     }else{
        // NOTHING IS CHECKED
     }
    

    First of all, have only one id="test"

    Secondly, try this:

    if ($('[name="test"]').is(':checked'))
    

    Something like this:

     $("input[name=test]").is(":checked");
    

    Using the jQuery is() function should work.

    链接地址: http://www.djcxy.com/p/55978.html

    上一篇: 正确的方式知道是否选中了复选框

    下一篇: 检查一个单选按钮是否被选中jquery