title: Javascript Calculate Date and Send value to textbox
body: <p>I'm having Javascript with this code:</p>
  
  <pre><code>function addRowss(frm) {
          var start = new Date(document.myform.bookstart.value);
          var ends = new Date(document.myform.bookend.value);
  
          var starts = document.myform.bookstart.value;
          var yeara = starts.substring(0, 2);
          var montha = starts.substring(3,6);
          var datea = starts.substring(7,11);
          var num3 = (ends - start)/1000/60/60/24;
          var i;
  
          for(i=0;i &lt;= num3; i++)
          {                   
              var theday = yeara+'-'+getnumo(montha)+'-'+datea;
              var resday = new Date(theday);
              rowNum ++;
              var row = '&lt;p id="rowNum'+rowNum+'"&gt;Date: &lt;input type="text" class="datepick" name="qty[]" id="date'+rowNum+'" value="'+theday+'"&gt; Price: &lt;input type="text" name="name[]" value="'+frm.add_name.value+'"&gt; &lt;input type="button" value="Remove" onclick="removeRow('+rowNum+');"&gt;&lt;/p&gt;';
              jQuery('#itemRows').append(row);
              yeara++;
          }
      }
  </code></pre>
  
  <p>What I want to do is text name[] will be automatically filled by my start date to my end date. For example, if I fill '06-Aug-2015' at start input and '06-Sep-2015' at end input, it will result about 30 textbox field which it's value will be filled by its date... so it will result: </p>
  
  <pre><code>[2015-08-06][ empty ]
  [2015-08-07][ empty ]
  [2015-08-08]
  ...
  [2015-09-06][ empty ]
  Note: [ ] = textbox
  </code></pre>
  
  <p>Right now I can add many textbox (attachment pic), but I can't set the value of this textbox as I want. Any idea?</p>
  
  <p><a href="https://i.stack.imgur.com/A8VEj.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/A8VEj.jpg" alt="enter image description here"></a></p>