title: Do something on Jquery mobile page close
body: <p>I want to call a function when the dialog is closed, however for testing purposes, I am just doing an alert for now, but the following does not work. </p>
  
  <pre><code> $("#fbfullpostviewpage").bind("pagehide",function(){
    alert("Dialog closed");
  });
  </code></pre>
  
  <p>But the same code with a different page id works? How would I make it work for this page too? </p>
  
  <p>markup:</p>
  
  <pre><code> if ((post.attachment.media !== undefined) &amp;&amp;
       (post.attachment.media.length &gt; 0) &amp;&amp;
       (post.attachment.media[0].type == "photo")) {
  
   markup += '&lt;li&gt;&lt;a href="#fbfullpostviewpage" class="item" data-rel="dialog" data-transition="pop" data-overlay-theme="e" data-inline="true" data-fullscreen="false"&gt;&lt;img src="' + thumb_url + '"&gt;' +'&lt;h5 style="white-space:normal;"&gt;' + name + '&lt;/h5&gt;&lt;p&gt;' +'posted this photo....&lt;/p&gt;&lt;p&gt;'+likes+'&lt;img src="images/facebook-like-16.png"&gt;&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;';
  
    }else { 
  
   markup += '&lt;li&gt;&lt;a href="#fbfullpostviewpage" class="item" data-rel="dialog" data-transition="pop" data-overlay-theme="e" data-inline="true" data-fullscreen="false"&gt;&lt;img src="https://graph.facebook.com/' + id + '/picture"&gt;'+'&lt;h5 style="white-space:normal;"&gt;' + name + '&lt;/h5&gt;&lt;p&gt;' + short_post +'....&lt;/p&gt;&lt;p&gt;'+likes+'&lt;img src="images/facebook-like-16.png"&gt;&lt;/p&gt;&lt;/a&gt;&lt;/li&gt;';
         } 
  </code></pre>