Get selected value of radio button in JS

Get selected value of radio button in JS

Fixed Rate Variable Rate Multi Rate
1 Like
<div id="rates">
  <input type="radio" id="r1" name="rate" value="Fixed Rate"> Fixed Rate
  <input type="radio" id="r2" name="rate" value="Variable Rate"> Variable Rate
  <input type="radio" id="r3" name="rate" value="Multi Rate" checked="checked"> Multi Rate  
</div>

we can use a attribute called “checked” with the radio button

1 Like

we need put value checked for fixed rate,variable rate and multi rate

i dont understand the question mam

ok got it checked is missing

1 Like

document.querySelector(‘input[name=“rate”]:checked’).value;

1 Like