count of selected radio buttons in jquery

后端 未结 3 1566
猫巷女王i
猫巷女王i 2021-02-20 06:38

suppose I have groups of radio buttons like so:

 
3条回答
  •  挽巷
    挽巷 (楼主)
    2021-02-20 07:25

    Use the checked-selector[docs] to get the ones that are checked, and the length[docs] property to find out how many there were.

    alert( $('input:radio:checked').length );
    

提交回复
热议问题