How to get the selected radio button’s value?

后端 未结 18 1573
北海茫月
北海茫月 2020-11-22 00:57

I’m having some strange problem with my JS program. I had this working properly but for some reason it’s no longer working. I just want to find the value of the radio button

18条回答
  •  情深已故
    2020-11-22 01:32

    lets suppose you need to place different rows of radio buttons in a form, each with separate attribute names ('option1','option2' etc) but the same class name. Perhaps you need them in multiple rows where they will each submit a value based on a scale of 1 to 5 pertaining to a question. you can write your javascript like so:

    
    

    I would also insert the final output into a hidden form element to be submitted together with the form.

提交回复
热议问题