How to add custom logic in Jquery Modal window close button event


Step 1:

Click this link to open modal window.

<a href="/sampleURL"  id="yourInfoModalLink">Test Link</a>

Step 2:

modal window UI

<div id="yourInfoModal" class="hide">
<div class="InfoContainer" id="InfoContainer" >
// add you custom UI/information here
</div>
</div>
Step 3:
to initialize and open modal window while click Test Link
$("#yourInfoModal").dialog({
autoOpen: false,
modal: true,
width: 550,
height: 240,
   close: function(event,ui){
    //This is option 1. you can place your custom logic here
   }
});
$('a#yourInfoModalLink').on('click', function (event) {

$("#yourInfoModal").removeClass("hide");
$("#yourInfoModal").dialog("open");
return false;

});
Step 4:
This step is required to add custom logic in close button event.
$('#yourInfoModal').live("dialogclose", function(){

//This is option 2. you can place your option here
});




Comments

Popular posts from this blog

Hybris / SAP Commerce Cloud Groovy Scripting Job to Generate CSV/Excel Reports and copy to Commerce cloud Blob Storage

Emma's dream - a kids story - By Kavya

Hybris/ SAP commerce Cloud: Retry failed/not sent emails due to SMTP connection issue.