jQuery defaultchecked VS checked
Situation:
I have checkbox elements on div(‘#dialog-a’) for a dialog. When an user clicks a button, then jQuery will bring the dialog with html code of div(‘#dialog-a’). Once, the user set checkbox and click “Close” button in the dialog, “Close” function supposes to set checkbox as “checked” in div(‘#dialog-a’).
I use the javascript code to set original checkbox as below:
[code]
$(“#elm_check”, “#hidden-area”).attr(“checked”, true);
[/code]
However, the issue occurs in here. The original checkbox does not remain as “checked” state, when the dialog opens again.
Solution:
Use the javascript as below:
[code]
$(“#elm_check”, “#hidden-area”).attr(“defaultChecked”, true);
[/code]
Caution: Interestingly, ‘defaultChecked’ is case-sensitive. If you apply ‘defaultchecked’, it was not working.