Get Radio button checked value.

Safaetul Ahasan
Nov 19, 2020

--

var weight_type = $('input[name=weight_type]:checked').val();
for (var i=0, len=weight_type.length; i<len; i++) {
if ( weight_type[i].checked ) { // radio checked?
weight_type = weight_type[i].value; // if so, hold its value in val
break; // and break out of for loop
}
}
console.log(weight_type);

--

--

Safaetul Ahasan
Safaetul Ahasan

No responses yet