javascript - different boxes with different checkboxs -
here's example: http://hamzakhan.name/dev/eric/options/five/fiveage.html
as can see, there 2 checkboxes in each box. tried adding javascript make checkbox behave radio buttons javascript adding script under html form code:
<script> $(".agecb").each(function() { $(this).change(function() { $(".agecb").prop('checked',false); $(this).prop('checked',true); }); }); </script>
but it's not working. see, when try click on 1 checkbox , click on checkbox in next panel, first 1 unchecked. how fix that? want work across each panel.
bear in mind there context; in case each pair of checkboxes within form element:
$('.agecb').on('change', function() { this.checked = true; $(this).closest('form').find('.agecb').not(this).prop('checked', false); });
Comments
Post a Comment