2

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 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!!

0

3 Answers 3

3

You don't need to call open, simply:

$('<div />').html('Hello sir').dialog();

And here's a live demo.

Sign up to request clarification or add additional context in comments.

1 Comment

Thank you that worked. Will accept this answer in 6 min when StackOverflow lets me :)
1

Have you made sure you have included jQuery.UI library in addition to core jQuery ?

see example here : http://jqueryui.com/demos/dialog/

1 Comment

Yes and I am able to open the dialog boxes in other places where I reference a div in the html code.
1

$("<div>This is a test</div>").dialog();

works fine for me http://jsfiddle.net/fyMct/

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.