First, don't treat this as duplicate since I do a few try & error, as well research before asking. I intended to post value from jquery including unchecked checkbox. I've tried many ways but still didn't manage to get it works, either due to structure of my code or else. Here is one of the attempt I try currently:
$('#l_sync_ul').click(function () {
if ($('#l_sync_ul').prop("checked") == undefined) {
$('#l_sync_ul').after('<input type="hidden" name="' + $('#l_sync_ul').attr("l_sync_ul") + '" value=off>')
} else {
$('#l_sync_ul').next().remove();
}
}
);
Here is the HTML file related:
<input name="l_sync_ul" id="l_sync_ul" onclick="toggle_tip('ul_dept')" type="checkbox">
Just ignore the 'onclicks' attribute since I'm using it for toggle the table.
Aucun commentaire:
Enregistrer un commentaire