Jquery how to get list of checked radio button value?

I have this jquery script

  function radiolist() {
        var radioChecked = [];
        var radios = $("input[type='radio']");
        for (var i = 0; i < radios.length; i++) {
            if (radios[i].checked) {

I want to save the list of checked radio buttons in the radioChecked array and access them. But I get the following error

Uncaught TypeError: radios[i].val is not a function

Why can`t to get radio button value ?

>Solution :

When you index an element in jQuery, it doesn’t rewrap the element in jQuery. So, you can either use the vanilla javascript approach with radios[i].value, or rewrap it in jQuery with $(radios[i]).val().

Leave a Reply