I am using dialog box from link jQuery Confirm
$.dialog({
title: '',
content:'test' ,
animation: 'scale',
boxWidth: '50%',
useBootstrap : false
});
Now I want to close it on button click. There are three custom button on which I perform different functionality on each and then want to close dialog box. So on each button I call onclik function in which some task is done. and then I want to close dialog box
<button onclick="update_details(some parameters);">Close</button>
function update_details(parameters)
{
// task here depend on parameters
// Close dialog box here
}
This button is inside dialog box. I tried possible solutions I found here but not working. I hide it using class. but then I can not reopen it. also tried to call close on $dialog
Update :
$.ajax({
type:'POST',
cache:false,
async:false,
url: 'url here',
data:{ },
success:function(resp){
if(resp!='')
{
for(var i =0; i < somelenghth from resp; i++)
{
str = str + '<button onclick="update_details(parameters);" class="btn btn-default">name</button><br><br>';
}
$.dialog({
title: '',
content:str ,
animation: 'scale',
boxWidth: '50%',
useBootstrap : false
});
}
}
});
.dialog()
: " removes buttons and explicitly shows the closeIcon (×) " - are you sure you don't want to use.confirm()
instead? – Constantin Groß