I have a code where i m using some checkboxes on click of them i m appending the checkbox value in url with hash but when i go back or press back button url gets changes but checkbox remains checked.Please check the code as follows
<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
</head>
<body>
<script type="text/javascript">
$(document).ready(function() {
$checkboxes = $('input[type=checkbox]');
$checkboxes.change(function(){
window.location.hash = 'check=' + $checkboxes.filter(':checked').map(function(){
return this.value;
}).get().join(",");
//console.log(window.location.hash);
}); });</script>
<input type="checkbox" name="check" value="one">one<br>
<input type="checkbox" name="check" value="two">two<br>
<input type="checkbox" name="check" value="one">three<br>
<input type="checkbox" name="check" value="two">four<br><input type="checkbox" name="check" value="one">five<br>
<input type="checkbox" name="check" value="two">six<br><input type="checkbox" name="check" value="one">seven<br>
<input type="checkbox" name="check" value="two">eight<br>
</body>
</html>
Right now when i click back after checking some checkboxes,url gets changed.but the checkbox still remains checked.How can i make checkbox unchek after going back once i checked some checkboxes...