0

I have a jQuery dialog on my page and for some reason I am using custom HTMl in the title option of dialog function which consists of a span as well (acting as close button for me):-

$("#myDivId").dialog({
    modal: true,
    resizable: false,
    closeOnEscape: false,
    draggable: false,
    title: "<div><span class='ui-dialog-title'>History</span>
           <a class='ui-dialog-titlebar-close ui-corner-all'>
          <span class='ui-icon ui-icon-closethick'>X</span></a></div>",
    width: 700,
    height: 300,
    open: function (event, ui) { 
        $('.ui-widget-overlay').css('height', $(window).height()); 
    },
    close: function () { alert(1); }
 });

Is there any way to call the close event of jQuery dialog on click of my span which consists of X text so that I can close the dialog?

Jazi
  • 6,569
  • 13
  • 60
  • 92
Rahul Singh
  • 21,585
  • 6
  • 41
  • 56

1 Answers1

0

How about this on your close function:

$('#myDivId').dialog('close')
FabioCosta
  • 3,069
  • 6
  • 28
  • 50