jQuery get value of selected radio button

前端 未结 27 2031
耶瑟儿~
耶瑟儿~ 2020-11-22 13:55

The problem statement is simple. I need to see if user has selected a radio button from a radio group. Every radio button in the group share same id.

The problem is

27条回答
  •  说谎
    说谎 (楼主)
    2020-11-22 14:20

    Even input is not necessary as suggested by other answers. The following code can also be used:

    var variable_name = $("[name='radio_name']:checked").val();
    

提交回复
热议问题