After a checkbox has been checked I display a form. If the form is canceled, I wish to uncheck the box.
In the HTML, I define:
<input id="current-checkbox" type="checkbox" class="hidden" />
In the associated JS I save the current position:
var curRow = $(this).closest('.trow').find('input[type=checkbox]');
$("#current-row",curRow);
console.log shows:
$("#current-checkbox")
[<input id="current-checkbox" type="checkbox" class="hidden">]
The cancel form JS:
$("#cancel-email").on('click', function (e) {
debugger
e.preventDefault();
setTimeout(function () { showMessage(1, 'Emails not sent.') }, 2000);
setTimeout(function () { hideEmailElems(); }, 2000);
$("#current-checkbox").find("input[type=checkbox]").prop("checked", false).focus();
});
console.log:
$("#current-checkbox").find("input[type=checkbox]").length
0
What is the correct jQuery selector to locate saved the checkbox?
Aucun commentaire:
Enregistrer un commentaire