Get Value of Radio button group

前端 未结 1 1437
予麋鹿
予麋鹿 2020-12-13 12:15

I\'m trying to get the value of two radio button groups using the jQuery syntax as given below. When the code below is run I get the value selected from the first radio butt

相关标签:
1条回答
  • 2020-12-13 12:39

    Your quotes only need to surround the value part of the attribute-equals selector, [attr='val'], like this:

    $('a#check_var').click(function() {
      alert($("input:radio[name='r']:checked").val()+ ' '+
            $("input:radio[name='s']:checked").val());
    });​
    

    You can see the working version here.

    0 讨论(0)
提交回复
热议问题