title: How to fire jQuery UI DatePicker onclick?
body: <p>The standard code for DatePicker is:</p>
  <pre><code>&lt;script&gt;
      $(function() {
         $( &quot;#datepicker&quot; ).datepicker();
      });
  &lt;/script&gt;
  &lt;p&gt;Date: &lt;input type=&quot;text&quot; id=&quot;datepicker&quot;&gt;&lt;/p&gt;
  </code></pre>
  <p>How to launch datepicker onclick event from inline HTML, I mean:</p>
  <pre><code>&lt;input ... onclick=&quot;&quot; &gt;
  </code></pre>
  <p>and with no separate JS code?</p>
  <p>I tried:</p>
  <pre><code>&lt;p&gt;Date: &lt;input type=&quot;text&quot; id=&quot;datepicker&quot; onclick=&quot;$(function() {$('#datepicker').datepicker();});&quot;&gt;&lt;/p&gt;
  </code></pre>
  <p>But it's working only on second click.</p>
  <p>How to make it work on first click?</p>