I have a jQuery script, which is triggered when a checkbox is selected (or deselected). It causes the whole page to be disabled, or enabled.
It is working as intended, but I have to start the page in “edit” mode.
I need to be able to set if the page starts in edit mode, or disabled mode when the page initially loads.
I can easily pass a variable via PHP – but I’m not sure where/how to do it, or what to trigger?
This is my triggering script
<script>
$('#switch-enable').change(function()
{
if ($('#switch-enable').is(':checked')) {
$('#disabled-switches *').prop("disabled", false);
} else {
$('#disabled-switches *').prop("disabled", true);
}
} );
</script>
Wrap the prop change code in a function, call it in
$(document).ready()and set the appropriatecheckedattribute on the checkbox viaphpeg.