My radio button are named dynamically. How to check all the checkbox on div click. The div and each radio has unique id. The div actually represent cards. I want upon clicking on card how to select all the listed radio in div How to dynamically get all child node from javascript but check all the radio
<div id=<?= ($counter-1) ?> class="card categoryCard" style="width: 18rem;">
<div class="card-body">
<h5 class="card-title"><?= $rows[$counter-1]["TICKETDESCRIPTION"]?></h5>
<input type="radio" id=<?='TICKETDESCRIPTION'.($counter-1) ?> name="TICKETDESCRIPTION" >
<p class="card-text"><label>RM <?= $rows[$counter-1]["TICKETPRICE"]?></label></p>
<input type="radio" id=<?='TICKETPRICE'.($counter-1) ?> name="TICKETPRICE" >
</div>
</div>
Below is my javascript code
$('.categoryCard').click(function(){
var id = $(this).attr('id');
var radiobtn = document.getElementById("TICKETDESCRIPTION"+id);
radiobtn.checked = true;
alert(id);
});
var radiobtn = document.getElementById("TICKETDESCRIPTION"+id);this can be replaced withvar radiobtn = $("#TICKETDESCRIPTION"+id);'input[type=radio]'