title: dynamic datetimepicker issue
body: <p><strong>What I did</strong></p>
  
  <p>I have created page where am adding datetime picker dynamically but now getting some problem here:</p>
  
  <pre><code>    for(i=0;i&lt;5;i++){
               counter=i;
               var appendTxt = "&lt;div style='display:none' class='divRow5 HideSchedule'&gt;&lt;div class='divCellouter4'&gt;&lt;div class='divCell2 rowwidth13 brdrStl4'&gt;&lt;input name='NEW_STARTdatetime[]' class='dtpkr' type='textbox' readonly='readonly' id='NEW_STARTdatetime["+counter+"]' value='' autocomplete='off' size='10' /&gt;&lt;/div&gt;&lt;div class='divCell2 rowwidth13  brdrSt14'&gt;&lt;input name='NEW_ENDdatetime[]' readonly='readonly' autocomplete='off' class='dtpkr' type='textbox' id='NEW_ENDdatetime["+counter+"]' value='' size='10' /&gt;&lt;/div&gt;&lt;div class='divCell2 rowwidth13  brdrSt14'&gt;&lt;input name='NEW_START_TIME[]' type='textbox' class='tmpkr' id='NEW_START_TIME["+counter+"]' value='' size='10' /&gt;&lt;/div&gt;&lt;div class='divCell2 rowwidth13  brdrSt14'&gt;&lt;input name='NEW_END_TIME[]' type='textbox' class='tmpkr' id='NEW_END_TIME["+counter+"]' value='' size='10' /&gt;&lt;/div&gt;&lt;div class='divCell2 rowwidth8   brdrSt14'&gt;&lt;input type='checkbox' name='new_promo_chk[]' id='new_promo_chk["+counter+"]' class='checkbox regular-checkbox big-checkbox' checked /&gt;&lt;label for='new_promo_chk["+counter+"]'&gt;&lt;/label&gt;&lt;/span&gt; &lt;/div&gt;&lt;/div&gt;&lt;div class='divCell2 handcursor'&gt; &lt;img class='del' src='images/delete.png' /&gt;&lt;/div&gt;&lt;/div&gt;";
               $('[id$="NEW_STARTdatetime\\['+counter+'\\]"]').datetimepicker({
                     // minDate:'-1970/01/02',
                      format:'Y/m/d',                
                      onShow:function( ct ){                                
                          this.setOptions({
                           maxDate:$('#NEW_ENDdatetime\\['+counter+'\\]').val()?$('#NEW_ENDdatetime\\['+counter+'\\]').val():false
                          })
                      },
                      timepicker:false     
              });
              $('[id$="NEW_ENDdatetime\\['+counter+'\\]"]').datetimepicker({
                      //minDate:'-1970/01/02',
                      format:'Y/m/d',                
                      onShow:function( ct ){
                          console.log('#NEW_STARTdatetime\\['+counter+'\\]');
                          console.log($('#NEW_STARTdatetime\\['+counter+'\\]').val());
                                this.setOptions({
                                 minDate:$('#NEW_STARTdatetime\\['+counter+'\\]').val()?$('#NEW_STARTdatetime\\['+counter+'\\]').val():false
                                })
                            },
                      timepicker:false          
              }); 
      }
  </code></pre>
  
  <p>so here now at the time of <strong>onshow</strong> it takes latest value of <strong>counter</strong>
  so my logic get fail,so how to fix that?</p>