jQuery get value of selected radio button

前端 未结 27 1859
耶瑟儿~
耶瑟儿~ 2020-11-22 13:55

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.

The problem is

27条回答
  •  遥遥无期
    2020-11-22 14:31

    multi group radio button covert value to array

    var arr = [];
        function r(n) {
    
    
            var section = $('input:radio[name="' + n + '"]:checked').val();
            arr[n] = section;
    
            console.log(arr)
        }
    
    1
    2
    3
    
    
    4 5 6

提交回复
热议问题