You could dialog box in the callback of the click funciton... $("#say_hello").click( > > function() { > $("body").prepend('<link type="text/css" rel="stylesheet" > id="example" href="css/jquery-ui.min.css" />'); > $.getScript("js/mail.js"); > $("#say_hello_box").dialog("open"); > }); >
On Mon, Aug 10, 2009 at 12:51 PM, ebakunin <ebaku...@gmail.com> wrote: > > Hello, > > When a user clicks a button I dynamically load large CSS and JS files. > I handle it in this way: > > $("#say_hello").click(function() { > $("body").prepend('<link type="text/css" rel="stylesheet" > id="example" href="css/jquery-ui.min.css" />'); > $.getScript("js/mail.js"); > $("#say_hello_box").dialog("open"); > }); > > It works great, but the problem is that sometimes the dialog box opens > before the CSS has loaded. I would like to add the equivalent of $ > ("#example").load(), since using load() does not seem to work. Can > anyone recommend a way to do this? Thanks for the help. -- Regards! Alexander Freiria - Programmer\Web Developer http://www.xandercs.com/ xanderco...@gmail.com 954.549.3666