title: jQuery datepicker without input
body: <p>I've got a fairly complex web app that I'd like to add some date-picking UI to.</p>
  
  <p>The problem I'm running into is that I haven't been able to figure out from the docs how to really take control of how and when the datepicker appears. There are no form elements involved (and no, I'm not going to add a secret form field), so the dead-simple out-of-the-box approach simply won't work.</p>
  
  <p>I'm hoping someone can provide a little guidance on a pattern that allows me to invoke the datepicker programmatically. I believe I know how I'd use the datepicker's custom events to initalize and position it, and to recover the chosen value when the user dismisses it. I'm just having a hard time instantiating a datepicker, since I'm not pairing it to an element.</p>
  
  <p>Here's what <em>isn't</em> working:</p>
  
  <pre><code>function doThing(sCurrent, event) { // sCurrent is the current value; event is an event I'm using for positioning information only
      var bIsDate = !isNaN( (new Date(sCurrent)).getTime() );
  
      jQuery.datepicker('dialog',
          (bIsDate ? new Date(sOriginal) : new Date()), // date
          function() { console.log('user picked a date'); }, // onSelect
          null, // settings (i haz none)
          event // position
      );
  
  }
  </code></pre>
  
  <p>The reason is that "jQuery.datepicker" isn't a function. (I'm Doing It Wrong.)</p>
  
  <p>I'm not married to the 'dialog' approach -- it was just my best guess at invoking one without reference to a form element.</p>
  
  <p>I'm using jQuery 1.4.3 and jQueryUI 1.8.6</p>