getting selected value of radio button in case of action

后端 未结 2 1047
慢半拍i
慢半拍i 2020-12-07 02:03

Hi here is the codes bellow, I\'ve tried many things but I couldnt get value of selected radio button.As you can see I need to get that value for diffrent situations.

<
2条回答
  •  情话喂你
    2020-12-07 02:30

    I choose let number of code for a required function. The one worked for me is given below from api.jquery.com. Hope this helps others.

    HTML

    option1
    option2
    

    JavaScript

    var selectedOption = $("input:radio[name=option]:checked").val()
    

    The variable selectedOption will contain the value of the selected radio button (i.e) o1 or o2

提交回复
热议问题