demos for the jquery ui dialog use the theme "flora". I wanted to customize the theme, so I used themeroller to generate the css file. When I used it, everything seemed to work fine, but later I found that I could not control any input element contained in the dialog box (i.e., I could not enter a text field, I could not check the checkboxes). Further research showed that this would happen if you set the dialog attribute βmodalβ to true. This does not happen when I use the theme of flora.
Here is the js file:
topMenu = { init: function(){ $("#my_button").bind("click", function(){ $("#SERVICE03_DLG").dialog("open"); $("#something").focus(); }); $("#SERVICE03_DLG").dialog({ autoOpen: false, modal: true, resizable: false, title: "my title", overlay: { opacity: 0.5, background: "black" }, buttons: { "OK": function() { alert("hi!"); }, "cancel": function() { $(this).dialog("close"); } }, close: function(){ $("#something").val(""); } }); } } $(document).ready(topMenu.init);
Here is the html that uses the flora theme:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <title>sample</title> <script src="jquery-1.2.6.min.js" language="JavaScript"></script> <link rel="stylesheet" href="flora/flora.all.css" type="text/css"> <script src="jquery-ui-personalized-1.5.2.min.js" language="JavaScript"></script> <script src="TopMenu.js" language="JavaScript"></script> </head> <body> <input type="button" value="click me!" id="my_button"> <div id="SERVICE03_DLG" class="flora">please enter something<br><br> <label for="something">somthing:</label> <input name="something" id="something" type="text" maxlength="20" size="24"> </div> </body> </html>
Here is the html that uses the downloaded themeroller theme:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> <title>sample</title> <script src="jquery-1.2.6.min.js" language="JavaScript"></script> <link rel="stylesheet" href="jquery-ui-themeroller.css" type="text/css"> <script src="jquery-ui-personalized-1.5.2.min.js" language="JavaScript"></script> <script src="TopMenu.js" language="JavaScript"></script> </head> <body> <input type="button" value="click me!" id="my_button"> <div id="SERVICE03_DLG" class="ui-dialog">please enter something<br><br> <label for="something">somthing:</label> <input name="something" id="something" type="text" maxlength="20" size="24"> </div> </body> </html>
As you can see, only css reference files and class names are different. Does anyone know what could be wrong?
@David: I tried and it does not work (neither on FF, nor on IE). I tried inline css:
style="z-index:5000"
and I also tried this, citing an external css file:
#SERVICE03_DLG{z-index:5000;}
But none of these works. Am I missing something in what you suggested?
Edit:
Solve by brostbeef!
Since I originally used flora, I mistakenly assumed that I should specify a class attribute. It turns out that this is true only when you actually use the theme of flora (as in the samples). If you use a custom theme, specifying a class attribute causes this strange behavior.