I have a screen with checkboxes, on click of the label a new window will be opened with text and an agree button. Once the user clicks the agree button, a cookie is set with a unique id referencing the checkbox. How do I check this checkbox based on if the cookie equals 1. Code is below
Initial checkbox:
<input type="checkbox" id="agreementChecker-0" name="agreeCheck-0" value="35" class="mandatory agreeChecker doc_35_readit">
New Window opens with text, button at bottom:
<p align="center" id="have_read_agreement" style="text-align:center;font-size:20px;"><a href="javascript:window.close()" class="btn-read">I have read this agreement and accept all terms and conditions.</a></p>
Javascript that sets the cookie:
document.cookie = "doc_35_readit=0";
$('#have_read_agreement').on('click', function(){
document.cookie = "doc_35_readit=1";
});
Now when the window is closed, not sure how to check the checkbox. Something like this maybe?
if (cookie("doc_35_readit") == "1") {
$(".doc_35_readit").click();
}
Any help would be appreciated
Aucun commentaire:
Enregistrer un commentaire