JQuery: How to get selected radio button value?

前端 未结 11 1252
北海茫月
北海茫月 2020-12-08 06:50

How do I default the value of a non-selected radio button to 0?

I have the following HTML:



        
11条回答
  •  Happy的楠姐
    2020-12-08 07:03

    To get the value of the selected Radio Button, Use RadioButtonName and the Form Id containing the RadioButton.

    $('input[name=radioName]:checked', '#myForm').val()
    

    OR by only

    $('form input[type=radio]:checked').val();
    

提交回复
热议问题