I have an issue with unchecking a check box.
I have this code in my html (php)
<div class="row">
<div class="col-md-12 pr-1">
<label>Modele</label>
<div class="form-group">
<div class="btn-group paymentBtnGroup btn-group-justified" data-toggle="buttons">
<?
if($result->num_rows > 0) {
$i = 1;
while ($row = $result->fetch_assoc()) {
echo "<label class='btn paymentMethod'>";
echo "<div class='method col-sm' style='background-image: url(" . "assets/img/produits/".$row["IMAGEPATH"].")'>";
echo "</div>";
echo "<input type='radio' aria-labelledby='".$row["NOM"]."' value='".$row["K_MODELE"]."' name='modele' id='modele$i'>";
echo "</label>";
$i++;
}
}
?>
</div>
</div>
</div>
</div>
and I try with a function to uncheck it once the form is added to my array.
so in my Jquery I try to use this line
$('.paymentBtnGroup input[type="radio"][name="modele"]').each(function(){
$(this).prop('checked', false);
});
but it give an undefined error for my radiobuttons and it doesn't work.
Any suggestions?
this
doesn't mean what you think it means. But you can simplify to this:
$('.paymentBtnGroup input[type="radio"][name="modele"]').prop('checked', false);