jQuery UI Dialog Error

Hello Experts!

Have any of you run into the following error, and found the solution?

I have code similar to the following:

var $dialog = $('<div></div>');

function popup() {
	var title = "Question";
	var html = "Would you like to do this?";
		title: title,
		resizable: false,
		buttons: {
			" Yes ": function() {
				$( this ).dialog( "close" );
			" No ": function() {
				$( this ).dialog( "close" );

Open in new window

However whenever I click on one of the buttons, I get a "cannot call methods on dialog prior to initialization; attempted to call method 'close'" error.

I'm using jquery-ui version 1.10.4 (the latest version.)
LVL 17
Who is Participating?

Improve company productivity with a Business Account.Sign Up

OmniUnlimitedConnect With a Mentor Author Commented:
Sorry, I found an extra $( this ).dialog( "close" ); in the yes and no functions.
Rainer JeschorCommented:
hm, your code seems to work fine in my sample jsfiddle:

Can you post a link to your page or attach your complete page?
Seems that the issue is coming from somewhere else / dependent from the rest of the page/script.

OmniUnlimitedAuthor Commented:
Did I mention that the problem only happens in IE?  Probably not, huh?

Sorry about that.  It appears that this little omitted fact is probably key to my problem as I can't even get your jsfiddle to work in my IE 8.
Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Rainer JeschorCommented:
OK - so its a browser specific / IE8 issue. I have to make a local test as jsFiddle does not run in IE8.

With which browser do you get the error? The jsFiddle works with IE11 (as well as simulated IE10 and 9).

Will be back soon - thanks.
OmniUnlimitedAuthor Commented:
I get the error in IE 8.
OmniUnlimitedAuthor Commented:
There would be no solution to this other than fixing the error in the yes and no functions.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.