开发者

How to put jQuery Dialog popup div into the jQuery code?

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/

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜