I am defining a toggle button in HTML and then updating it's checked state in JavaScript based on another toggle button.

Toggle Button: <input type="checkbox" dojoType="dijit.form.ToggleButton" iconClass="dijitCheckBoxIcon" label="Assigned Work" id="AssignedWork" >

When the app runs I want this toggle button to be un-checked.

I can successfully call the checked property like this:

Registry.byId("AssignedWork").checked = true;

However my toggle button's icon isn't updating to indicate the "Check". When my mouse cursor hovers over the toggle button the button refreshes and shows the check mark. Is there a way to get the check icon to turn on with the .checked property?

有帮助吗?

解决方案

You need to use set like

Registry.byId("AssignedWork").set("checked",true);

Here is a fiddle http://jsfiddle.net/t47DR/2/

You should also be aware that the syntax you are using is very outdated, so if you aren't using an older version of dojo, change your syntax.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top