Hide Dialog Box when click on OK Button

I am using below which you  have specified here "https://ej2.syncfusion.com/javascript/documentation/dialog/dialog-utility/ "

Here my question is how to HIDE the DIALOG Box when I click on OK Button. 

document.getElementById('targetButton').onclick = function(){
// Initialize and render confirm dialog with custom options

ej.popups.DialogUtility.confirm({
        title: ' Confirmation Dialog',
        content: "This is a Confirmation Dialog!",
        okButton: {  text: 'OK', click: okClick },
        cancelButton: {  text: 'Cancel', click: cancelClick },
        showCloseIcon: true,
        closeOnEscape: true,
        animationSettings: { effect: 'Zoom' }
    });
};

function okClick(){
    alert('you clicked OK button');
}

function cancelClick(){
    alert('you clicked Cancel button');
}

1 Reply 1 reply marked as answer

BS Buvana Sathasivam Syncfusion Team February 23, 2022 09:52 AM UTC

Hi Veet, 
Greetings from Syncfusion support. 
You can use the dialog hide method to close the dialog when you click the Ok button. Please see below the code and sample. 
  ej.popups.DialogUtility.confirm({ 
    okButton: { text: 'OK'click: okClick }, 
……….. 
  }); 
}; 
 
function okClick() { 
  this.hide(); 
} 
We will update the documentation code and include it in one of our upcoming releases. 
Regards, 
Buvana S 


Marked as answer
Loader.
Up arrow icon