How to check radio button is checked using JQuery?

后端 未结 8 817
猫巷女王i
猫巷女王i 2020-12-24 07:20

I have two radio buttons in one group, I want to check the radio button is checked or not using JQuery, How ?

8条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-24 07:21

    Taking some answers one step further - if you do the following you can check if any element within the radio group has been checked:

    if ($('input[name="yourRadioNames"]:checked').val()){ (checked) or if (!$('input[name="yourRadioNames"]:checked').val()){ (not checked)

提交回复
热议问题