javascript - Mark the radio button checked after clicking the anchor tag -
when click on anchor tag, radio button inside must marked checked. data coming through loop there large amount of data. here code:
<a class="toggleanchor sectionsdiv accordion-toggle <?php if($i!=1){ ?> collapsed <?php } ?>" data-toggle="collapse" data-parent="#accordion" href="#collapseone<?=$i;?>"> <div class="col-md-12 col-sm-12 col-xs-12"> <div class="form-group col-md-4 col-sm-4" style="padding:0;"> <div class="checkbox checkreward"> <label> <input type="radio" name="radio" <?php if($i==1){ ?> checked <?php } ?> class="form-control radio-height" id="radioid<?=$z;?>" value="<?=$reward['amt'];?>"/> $<?=$reward['amt'];?> <input type="hidden" id="giftval-<?=$z;?>" value="<?= ucwords($reward['gift']);?>"/> </label> </div> </div> <div id="hight-light<?=$z;?>" class="col-md-8 col-sm-8 textreward"> <h2><?= ucwords($reward['entry']);?></h2> <h4 class="text-uppercase text-white"> <b><?=$reward['sup'];?></b> </h4> </div><!--.col1 text-center--> </div> <br clear="all" /> </a>
this anchor repeated in loop, data change every time. how can make work? tried different code couldn't work. like
$(".toggleanchor").click(function(event) { $(radio).attr("checked", true); });
please use this...
$(".toggleanchor").click(function(event) { $(this).find('input[type="radio"]').prop("checked", true); });
Comments
Post a Comment