How to wait for a popup to close in jQuery Mobile?

callback, javascript, jquery, jquery-mobile, popup

Solution

You can use the popupafterclose event, below is the snippet on how to do it.

For more information you can look at the jQuery-Mobile Docs

$( "#my_popup" ).bind({
   popupafterclose: function(event, ui) { ... }
});

Problem

In jQuery Mobile 1.2.0 i'm using the new popup widget. ``` $('#my_popup').popup('close'); $('#my_popup').popup('open'); ``` I obviously want to wait until the the popup closes completely before i open it again. The close method does not provide a callback function option.

Original source