I have a very simple message to display in one jQuery popup and I just want to generate it without adding extra divs into my HTML.
What I'd like to do is just open a dialog box with a message and thats it.
Here is 开发者_JAVA技巧something like that I want:
$("<div>Hello sir</div>").dialog("open");
But that doesn't work. Should it? It seems like that should just open a simple dialog box, shouldn't it?
Thanks!!
You don't need to call open
, simply:
$('<div />').html('Hello sir').dialog();
And here's a live demo.
Have you made sure you have included jQuery.UI library in addition to core jQuery ?
see example here : http://jqueryui.com/demos/dialog/
$("<div>This is a test</div>").dialog();
works fine for me http://jsfiddle.net/fyMct/
精彩评论