Check whether specific radio button is checked

后端 未结 7 1047
忘掉有多难
忘掉有多难 2020-12-14 01:10

I\'m having trouble after looking at the jQuery docs. I\'m just trying to return true/false in one my my jquery methods depending on the check of a certain radiobutton and

相关标签:
7条回答
  • 2020-12-14 01:34

    You should remove the '@' before 'name'; it's not needed anymore (for current jQuery versions).

    You're want to return all checked elements with name 'test2', but you don't have any elements with that name, you're using an id of 'test2'.

    If you're going to use IDs, just try:

    return $('#test2').attr('checked');
    
    0 讨论(0)
提交回复
热议问题