getting selected value of radio button in case of action

后端 未结 2 1049
慢半拍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:39

    You can use document.getElementsByName() or document.getElementsByTagName("input") to get an array of input elements. Loop through those elements to check which is checked.

    Here is an example of how to get the value of the checked button from a set of radio buttons with the name "selected":

    
        
            
        
        
            
    1
    2
    3

提交回复
热议问题