开发者

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

开发者 https://www.devze.com 2023-04-12 19:48 出处:网络
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.

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

精彩评论

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