I am opening a dialog box with a button click event. Dialog box contains ok and cancel button. In IE it works normaly but in firefox dialog is opening ‘cancel’ button is working but ‘ok’ button nothing is happening.
Below is the code of a button in which i am opening a dialog.
$('#addImage').click(function ()
{
var url = 'Default.aspx';
var d = $('#dialog_img').html('<iframe id="ifrm" , width = 540 , height = 170></iframe>');
$("#dialog_img>#ifrm").attr("src", url);
d.dialog('open').dialog({ modal: true ,width: 560,resizable: false ,
buttons:
{
'OK': function() {
var img = document.createElement('img');
$(img).attr("id", "dyndiv" + count);
$(img).attr("width", 30);
$(img).attr("height", 50);
$(img).attr("src", 'Uploads/'+window.frames['ifrm'].document.getElementById('dvFileName').innerHTML) ;
var $ctrl = $(img).resizable({ containment: '#containment-wrapper'}).parent().addClass("resizable mydiv").draggable({
containment: '#containment-wrapper',
cursor: 'move',
delay: 200,
distance: 30,
opacity: 0.35
})
objid = "dyndiv" + count;
$(img).css("z-index" , $(img).css("z-index") + count );
$('#sel_obj_text').val("Image");
image_visibility();
count++;
$("#containment-wrapper").append($ctrl);
$('#' + objid).parent().css("position","relative");
$('#' + objid).parent().position({
of: $( "#containment-wrapper" ),
my: "center" + " " + "center",
at: "center" + " " + "center"
});
$(this).dialog('destroy');
},
'Cancel': function() {
$(this).dialog('destroy');
}
}
});
});
You’re missing a semi-colon (
;) after your$ctrldeclaration.In your original code, its this line:
In the edited code: