Hi,
I'm trying to figure out how to use the jQuery UI dialog widget, and I am able to pop up a simple test widget.

However, jQuery needs a snippet of HTML to populate the widget, like so:

$('#dialog').dialog();

Where do you guys typically stick that HTML? I know I can use jQuery to append it to the page and then immediately consume it with the dialog() call, but that is less than elegant. Ideas or suggestions or most welcome!

TIA.

Comments

aj045’s picture

I imagine that dialog boxes start out not displaying. So they contain the CSS property, "display: none". If dialog() simply operates on toggling that element's "display" property to show/hide that box, then set your HTML for your dialog to be "display: none". Simple as that.

thorie’s picture

Thanks -- that indeed is what I ended up doing, except I emit the HTML in the PHP instead. It works, but it's not what I'd call elegant code... ;)

Oh, and I switched to SimpleModal instead of trying to get the jQuery UI dialog to work. There were simply too many issues with it.

rdworth’s picture

I'm very curious what problems you had with the jQuery UI Dialog. We've tried to make it as easy to use as possible. With your help and feedback, I'm sure we can make it better. Thanks.

thorie’s picture

Hi -- sorry it took me so long to reply; I wasn't tracking this thread.

Basically, the problem was that the code emitted tags with lots of style attributes. This made it very hard or impossible to override it with my own CSS. I'd have preferred a solution that relies on external CSS.