javascript keep checkbox checked after refresh page
hi i am javascript newbie.
I have checkbox that slideDown other input , i want to keep that checkbox
checked and the other input showed after refreshing the page if the input
checkbox checked
javascript:
function validateSitec(){
if (document.getElementById('sitecheck').checked){
$('#sitecheck').prop('checked', true);
$('#closedmsg').slideDown();
}else{
$('#closedmsg').slideUp();
$("#sitecheck").removeProp("checked").checkboxradio("refresh");
}
}
this my inputs:
<label for="sitecheck">
<span style="font-weight:bold;">close site+ msg:</span>
</label>
<input name="" type="checkbox" id="sitecheck" onclick="validateSitec()"
/><span style="font-weight:bold;">click to activate msg</span><br>
<input type="text" name="closedmsg" id="closedmsg"
style="width:440px;height:120px;display:none;" value="enter closed
msg.."/>
i want if checked stay checked.. and wont change after refreshing the page
, then when unchecked so back to normal and be unchecked when refreshing
the page..
should i use php for making it not change after checking with javascript?
No comments:
Post a Comment