Quantcast
Channel: Active questions tagged html - Stack Overflow
Viewing all articles
Browse latest Browse all 67527

How to use radio buttons in repeating form group

$
0
0

I am using a repeating form field inside the SAME FORM. I have my input form field named as an array e.g. first_name[], gender[].

In this case when a radio button is clicked then it affects radio buttons of other repeated form groups.

$('#repeatButton ').on('click', function() {
  var repeater = $('#repeater .items').clone();
  $('#repeater').append(repeater);
});
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script><form action=""><div id="repeater"><div class="form-group items"><input type="radio" value="male" name="gender[]"><label>Male</label><input type="radio" value="female" name="gender[]"><label>Female</label></div></div><input value="add" id="repeatButton"></form>

Viewing all articles
Browse latest Browse all 67527

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>