<input type="checkbox" name="allowedEntireDay_<?php echo $shortDay; ?>" class="allowedEntireDay"
<?php
$key = "allowedEntireDay_" . $shortDay;
echo (!isset($targetedAd[$key]) || (isset($targetedAd[$key]) && $targetedAd[$key] == "on")) ? 'checked' : "";
?>>
This is my HTML code $shortDay and $targetedAd[$key] the two parameter from backend . In my code when value set 'on' checkbox need to tick , if 'off' set in value checkbox need to untick . In my case 'on' 'off' are set in the value But check and uncheck are not work .
java script
$("input:checkbox[name='allowedEntireDay_Tu']")
.val(response.targetedAd.allowedEntireDay_Tu)
.prop('checked', true);
Aucun commentaire:
Enregistrer un commentaire