title: FancyBox 2 Changing FancyBox Title When New IFrame/Content Is loaded
body: <p>I would like to know how is it possible to change the title of a FancyBox window when new content is loaded in the window. I have an application in which a page is called in a FancyBox window it looks something like this :</p>
  
  <p><strong>Code</strong></p>
  
  <pre><code>&lt;script type="text/javascript"&gt;     
  
          $(document).ready(function() {
  
              $(".fancybox").fancybox({
  
                  autoDimensions : false,
                  width: 1300,
                  height: 'auto',
                  openEffect  : 'elastic',
                  closeEffect : 'elastic',
                  type: 'iframe',            
  
                  afterLoad: function(){
                      this.title = $(this.element).attr('caption');
                  }
  
              });         
          });
      &lt;/script&gt;
  
  
    &lt;title&gt;&lt;fmt:message key="title"/&gt;&lt;/title&gt;     
  
  
    &lt;/head&gt;
    &lt;body&gt;
      &lt;h1&gt;&lt;fmt:message key="heading"/&gt;&lt;/h1&gt;
      &lt;p&gt;&lt;fmt:message key="greeting"/&gt;&lt;/p&gt;
  
  
      &lt;p&gt;&lt;a class="fancybox fancybox.iframe" caption ="Officer Registration" href="officer_registration.htm" &gt;Officer Registration&lt;/a&gt;&lt;/p&gt;
  
      &lt;p&gt;&lt;a class="fancybox fancybox.iframe" caption ="Citizen Registration" href="&lt;c:url value="citizen_registration.htm"/&gt;"&gt;Citizen Registration&lt;/a&gt;&lt;/p&gt;
  
  
     &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>The pages are called and displayed in fancy box using the href tags. Fancy box sets the title based on the caption attribute defined in the element. When the page that is loaded into fancy box is submitted to the server the server returns another page and this page replaces the content in the fancybox window with the new content, however the title remains the same as set in the old content and does not change.</p>
  
  <p>I would like to now how to change the title of fancybox when the content of the iframe.</p>