datepicker opens after ajax call on second click? how to open it on first click?
<p>before ajax call I write the code for date picker is:</p>

<pre><code>&lt;script type="text/javascript"&gt;
    $(function() {
        $("#birthdate").focus(function() {
            $(this).datepicker().datepicker( "show" )
        });
    });
    $(function() {
        $("#joindate").focus(function() {
            $(this).datepicker().datepicker( "show" )
        });
    });
    &lt;/script&gt;           
</code></pre>

<p>this function called after onfocus event:         </p>

<pre><code>&lt;tr&gt;
              &lt;td align="left"&gt;
                &lt;input type="text" id="birthdate"  name="birthdate"  onfocus="$('#birthdate').datepicker({changeMonth: true,changeYear: true,dateFormat: 'dd/mm/yy',defaultDate: '-20y -1m -247d',yearRange: '-50:+0'});"   tabindex="14"  style="width:300px; "   value="&lt;? if($get_emp!='0')echo $employee_birth; ?&gt;" /&gt;&lt;span style="color:#F00;"&gt;*&lt;/span&gt;&lt;/td&gt;                                       

    &lt;td&gt;
        &lt;input type="text" name="joindate" id="joindate" onfocus="$('#joindate').datepicker({changeMonth: true,changeYear: true,dateFormat: 'dd/mm/yy',defaultDate: '-3y -1m -247d',yearRange: '-50:+0'});"  tabindex="15" style="width:300px; " value="&lt;? if($get_emp!='0')echo $employee_join; ?&gt;"/&gt;&lt;span style="color:#F00;"&gt;*&lt;/span&gt;
        &lt;/td&gt;
     &lt;/tr&gt;
</code></pre>

<p>after ajax call I call the same code but it not opens on first click , however it opens on second click?
please help me to sort out this problem..........................                </p>
