title: jquery datepicker multiple instances
body: <p>I have made a RequestForQuote form, in which I give the possebility to add new positions to get RFQ'ed.</p>
  
  <p>In basics this is quite easy done via PHP in my case. Work realy fine. You may want to have a look. It is to be found at: <a href="http://www.thermo-control.com/de/produkthilfe/anfrage065.php" rel="nofollow noreferrer">my website</a></p>
  
  <p>Now I got infected with the jquery-virus and simply wanted to add the datepicker ui (for the latest version I got from their webpage). </p>
  
  <pre><code>&lt;input type="text" size="10" id="deldate[] 
       class="datepicker" value="&lt;?php echo $_REQUEST['deldate'][$k]; ?&gt;" /&gt;
  </code></pre>
  
  <p>$k is from a php <code>for($k=0;$k&lt;=$NoPos;$k++)</code> loop</p>
  
  <p>the javascript code work is like:</p>
  
  <pre><code>$(function() {
  $('input').filter('.datepicker').datepicker({
          showOn: 'button', 
          buttonImage: 'calender/media/cal.gif', 
          buttonImageOnly: true,
          firstDay: 1,
          dateFormat: 'yy-mm-dd', 
          minDate: 0, maxDate: '+4Y'});
  
  }); 
  </code></pre>
  
  <p>An in the browswer it looks quite nice, the ui shows up, I cann select a date.</p>
  
  <p>BUT...</p>
  
  <p>if I add another position to the form, which is done via PHP, so I have to submit the form to count $NoPos up, the formerly inersted date(s) is lost and I have a blank input-field.</p>
  
  <p>now with the 
  <code>onSubmit: function(dateText)</code> I can get the selected date. However I am failing in accessing the correct input field to put the date in.</p>
  
  <p>So my question is simple: What am I doing wrong? If evrything is fine then someone would please please tell me how I can solve this..</p>
  
  <p>I have thougth of something such as:</p>
  
  <pre><code>for (var i=0;i&lt;=NoPos;i++) {
      var tag = "#deldate"+i;
      $(tag).datepicker({ ... });
  }
  </code></pre>
  
  <p>and using php to <code>&lt;input type="text" size="10" id="lieferdat&lt;?php echo $k; ?&gt;" class="datepicker" /&gt;</code></p>
  
  <p>Many thanks for your assumed patience to read through this...</p>
  
  <p>and many more thanks for any hints given</p>
  
  <p>Cheers Daniel</p>