title: jquery fancybox input focus
body: <p>I am using cakephp 1.3 and fancybox..I have managed to put a form in fancybox.Now i want to focus cursor into the one of the input field. I am pretty tired of trying many thing.My code given below</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
  jQuery(document).ready( function() {
  //document.getElementById('frmname.answer').focus(); 
  jQuery("a#answer").fancybox({
          'transitionIn'  :   'elastic',
          'transitionOut' :   'elastic',
          'speedIn'    :  600, 
          'speedOut'   :  200, 
          'overlayShow'   :   false,
          'href'  : this.href,
  });
  
  }); /* */
  &lt;/script&gt;
  </code></pre>
  
  <p>I tried following things</p>
  
  <pre><code>'onComplete' : function() {
                 $('#fancybox-frame').contents().find('#answer').focus();
              },
  </code></pre>
  
  <p>and</p>
  
  <pre><code>$('#answer').focus();
  </code></pre>
  
  <p>in my script.But no good result>can any one point out the wrong i am doing with my code.Thanks in advance.</p>
  
  <p>My fancybox content is like this:</p>
  
  <pre><code>&lt;div style='display:none'&gt;
      &lt;div id='reply'&gt;
  
          &lt;h1&gt;Reply For &lt;?php echo $offer['OfferBoard']['headline'] ?&gt;&lt;/h1&gt;
  
  
          &lt;ul class="nrml_list" &gt; 
  
                  &lt;?php echo $this-&gt;Form-&gt;create('OfferAnswer',array('id'=&gt;'frm','name'=&gt;'frmname'), array('action' =&gt; 'reply/'.$offer['OfferBoard']['id'],'inputDefaults'=&gt; array('label'=&gt;false))); ?&gt;
  
  
                  &lt;li&gt; 
                      &lt;div class='ulabel' style="float:right;" &gt;Reply Text&lt;/div&gt;
                      &lt;div&gt;
                          &lt;div class="left"&gt;&lt;?php echo $form-&gt;textarea('answer',array('class'=&gt;'tarea1','label'=&gt;FALSE,'id'=&gt;'answer')); ?&gt;&lt;/div&gt;
                          &lt;div class="clear"&gt;&lt;/div&gt;
                          &lt;/div&gt;  
                  &lt;/li&gt;
  
                  &lt;li&gt; 
                      &lt;div class='ulabel' &gt;&lt;/div&gt;
                      &lt;div&gt;
                          &lt;div class="left"&gt;&lt;?php 
                                  $attributes=array('type'=&gt;'checkbox','div'=&gt;false,'value' =&gt; '1','hiddenField' =&gt; false,'label'=&gt;FALSE);
                                  echo $this-&gt;Form-&gt;input('copy_to',$attributes)." Send Copy ";  
                          ?&gt;&lt;/div&gt;
                          &lt;div class="clear"&gt;&lt;/div&gt;
                          &lt;/div&gt;  
                  &lt;/li&gt;
  
  
  
          &lt;/ul&gt;
              &lt;?php echo $this-&gt;Form-&gt;end('Reply'); ?&gt;
  
  
  
      &lt;/div&gt;
  </code></pre>