JQuery UI question, how do you add variables into the dialog box

Posted on Stack Overflow See other posts from Stack Overflow
Published on 2009-08-26T15:38:05Z Indexed on 2010/05/24 4:11 UTC
Read the original article Hit count: 280

Filed under:
|
|
$('.openDialog').click(function(event){
    	var width=$(this).attr('width');
    	var height=$(this).attr('height');
    	alert(width + ' ' + height);
    	event.preventDefault();
    	$("#dialog").dialog({autoOpen: false, modal: true});
    	$('#dialog').dialog('option', 'width', width);
    	$('#dialog').dialog('open');
    	$('#dialog p').load('http://pagetoload.com/page.html .content');
});

As you can see above i'm trying to open a dialog box with a passed in parameter of width and height, however when I try and pass in the value of width on this line:

$('#dialog').dialog('option', 'width', width);

it doesn't work, any ideas why or how to get around that?

Thanks

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about jquery-ui