jQuery獲取所選單選按鈕的值 - jQuery get value of selected radio button

問題:

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.組中的每個單選按鈕共享相同的 ID。

The problem is that I don't have control on how the form is generated.問題是我無法控制表單的生成方式。 Here is the sample code of how a radio button control code looks like:以下是單選按鈕控件代碼的示例代碼:

<input type="radio" name='s_2_1_6_0' value='Mail copy to my bill to address' id = "InvCopyRadio" onchange = 'SWESubmitForm(document.SWEForm2_0,s_4,"","1-DPWJJF")' style="height:20;width:25" tabindex=1997 >

In addition to this when a radio button is selected it doesn't add a "checked" attribute to the control just text checked (I guess just the property checked without a value) . In addition to this when a radio button is selected it doesn't add a "checked" attribute to the control just text checked (I guess just the property checked without a value) . Below is how a selected radio control looks like下面是選定的無線電控件的樣子

<input type="radio" checked name='s_2_1_6_0' value='Mail copy to my bill to address' id = "InvCopyRadio" onchange = 'SWESubmitForm(document.SWEForm2_0,s_4,"","1-DPWJJF")' style="height:20;width:25" tabindex=1997 >

Can anybody help me with jQuery code that can help me to get the value of checked radio button?任何人都可以幫助我使用可以幫助我獲取選中單選按鈕值的 jQuery 代碼嗎?


解決方案:

參考一: https://en.stackoom.com/question/aB3w
參考二: https://stackoom.com/question/aB3w
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章