It is important that the browser does not remember the former state.
This example is extendable with any buttons, checkmarks, radiobuttons ect.
Example
page1:
set checkmark which enables the button,
press the button,
you are directed to page2
page2:
somthing fails or whyever you press back to return to page 1,
the settings should be set to default
Code: Select all
<script type="text/javascript">
document.getElementById("contactCheckbox1").autocomplete = "off";
document.getElementById("contactCheckbox1").addEventListener("change", function(){
if(document.getElementById("contactCheckbox1").checked){
enable_send_button();
} else {
disable_send_button();
}
});
$(window).bind("pageshow", function(){
disable_send_button();
});
function enable_send_button() {
document.getElementById("contactAdvancedButton3").style.borderColor = "#32CD32";
document.getElementById("contactAdvancedButton3").style.backgroundColor = "#32CD32";
document.getElementById("contactAdvancedButton3").disabled = false;
}
function disable_send_button() {
document.getElementById("contactAdvancedButton3").style.borderColor = "#A9A9A9";
document.getElementById("contactAdvancedButton3").style.backgroundColor = "#A9A9A9";
document.getElementById("contactAdvancedButton3").disabled = true;
}
</script>