I have a jQuery UI Dialog containing some checkboxes. I want to conditionally set the state of these flags and open a dialog box.
Unfortunately, this causes problems in IE6. A flag is never checked if it is set before opening a dialog.
For example, in the following code, Dialog Box 1 is never checked in IE6, but is located in any other browser.
[Update] The problem is how IE6 resets the state of any flag that is added anywhere. And when the dialog opens, the jQuery user interface attaches it to the upper body. Apparently, "it is a known fact that when working with IE checked state flags lose their state when they are added [anywhere]" (see link below)
This jQuery forum post offers some resolution, but concerns changing the jQuery user interface code; what I would rather do if at all possible.
Are there any solutions for this?
Thank,
D.
the code:
<script type="text/javascript">
$(document).ready(function() {
$('#dialog').dialog({
autoOpen : false,
modal : true
});
$("a#openDialog").click(function() {
$("#formContainer .check1").attr("checked", true);
$('#dialog').dialog('open');
$("#formContainer .check2").attr("checked", true);
});
});
</script>
<h1>jQuery Dialog/Checkbox Test</h1>
<a href="#" id="openDialog">Open Dialog</a>
<div id="dialog">
<form>
<div id="formContainer">
Dialog Checkbox 1: <input type="checkbox" value="blue" class="check1"/>
Dialog Checkbox 2: <input type="checkbox" value="red" class="check2"/>
</div>
</form>
</div>
source
share