Question

I wrote a simple function:

function updatePhase6Visibility(checkbox) {
            //alert("working");
            if (checkbox.checked) {
                Phase6.show();
            }
            else {
                Phase6.hide();
            }
        }

The checkbox is shown in HTML using:

<input id="mycheck6" name="mycheck" type="checkbox" data-dojo-type="dijit/form/CheckBox" value="agreed" checked onclick="updatePhase6Visibility(this);" /> <label for="mycheck6">Phase 6</label>

The initial state is checked - how do I change this to unchecked?

Was it helpful?

Solution

Remove "checked"

Original:
<input id="mycheck6" name="mycheck" type="checkbox" data-dojo-type="dijit/form/CheckBox" value="agreed" checked onclick="updatePhase6Visibility(this);" /> <label for="mycheck6">Phase 6</label>

Updated:
<input id="mycheck6" name="mycheck" type="checkbox" data-dojo-type="dijit/form/CheckBox" value="agreed" onclick="updatePhase6Visibility(this);" /> <label for="mycheck6">Phase 6</label>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top