title: how to Auto Increment the value in input field (type=text) that is dynamically added on a button click?
body: <p>I want to have a value in "sr.no." field that is auto incremented every time i click on button that adds new clause.</p>
  
  <p>html:</p>
  
  <pre><code>&lt;div id="clauseDiv"&gt;
  &lt;div class="col-sm-12"&gt;
      &lt;div class="col-sm-6"&gt;
          &lt;div class="form-group"&gt;
              &lt;label class="control-label col-sm-2" for="clause"&gt;Clause: &lt;/label&gt;
              &lt;div class="col-sm-10"&gt;
                  &lt;input type="text" class="form-control clauseHeader" v-bind:id="'clauseHeader-' + clause.contractGroupId" 
                      name="clause"  :key="index" v-bind:value="clause.contractGroupName" readonly="readonly"/&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-sm-4"&gt;
          &lt;div class="form-group"&gt;
              &lt;label class="control-label col-sm-2" for="sequence"&gt;Sr.no.: &lt;/label&gt;
              &lt;div class="col-sm-4"&gt;
                  &lt;input type="text" class="form-control clauseSequence" v-bind:id="'clauseSequence-' + clause.contractGroupId" name="sequence" 
                  :key="index" v-bind:value="clause.sequence" /&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
      &lt;div class="col-sm-12"&gt;
          &lt;div class="form-group"&gt;
              &lt;label class="control-label col-sm-1" for="subClause"&gt;Subclause: &lt;/label&gt;
              &lt;div class="col-sm-11"&gt;
                      &lt;div&gt;
                          &lt;textarea class="form-control subClause" v-bind:id="'subClause-' + clause.contractGroupId" 
                          :key="index" readonly="readonly"&gt;&lt;/textarea&gt; 
                      &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
      &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p></p>
  
  <p>js:</p>
  
  <pre><code>var clauseHtml = '&lt;div class="col-sm-12" id="clause-'+this.count+'"&gt;'+
                  '&lt;div class="col-sm-6"&gt;'+
                      '&lt;div class="form-group"&gt;'+
                      '   &lt;label class="control-label col-sm-2" for="clause"&gt;Clause: &lt;/label&gt;'+
                      '    &lt;div class="col-sm-10"&gt;'+
                     '        &lt;input type="text" class="form-control clauseAddlTermHeader" id="clauseHeader-'+this.count+'" name="clause" /&gt;'+
                    '      &lt;/div&gt;'+
                   '   &lt;/div&gt;'+
                  '&lt;/div&gt;'+
                  '&lt;div class="col-sm-4"&gt;'+
                      '&lt;div class="form-group"&gt;'+
                    '      &lt;label class="control-label col-sm-2" for="sequence"&gt;Sr.no: &lt;/label&gt;'+
                   '       &lt;div class="col-sm-4"&gt;'+
                  '           &lt;input type="text" class="form-control clauseAddlTermSequence" id="clauseSequence-'+this.count+'" name="sequence"/&gt;'+
                 '        &lt;/div&gt;'+
                '      &lt;/div&gt;'+
               '   &lt;/div&gt;'+
               '&lt;div class="col-sm-2"&gt;'+
                  '&lt;div class="form-group"&gt;'+
              '       &lt;button type="button" class="btn btn-danger deleteClause" id="deleteClause-'+this.count+'" v-on:click="deleteClause"&gt;Delete&lt;/button&gt;'+
            '      &lt;/div&gt;'+
           '   &lt;/div&gt;'+
              '&lt;div class="col-sm-12"&gt;'+
                '  &lt;div class="form-group"&gt;'+
               '      &lt;label class="control-label col-sm-1" for="subClause"&gt;Subclause: &lt;/label&gt;'+
              '       &lt;div class="col-sm-11"&gt;'+
             '           &lt;textarea class="form-control clauseAddlTermSubClause" id="subClause-'+this.count+'" &gt;&lt;/textarea&gt;'+
            '         &lt;/div&gt;'+
           '       &lt;/div&gt;'+
          '    &lt;/div&gt;'+
           '&lt;/div&gt;';
                  $('#clauseDiv').append(clauseHtml);
                  this.count++;
  </code></pre>
  
  <p>From html, I am adding div which contains 'clause', 'sr.no.' and 'subclause' fields. I have a button, and when clicked on that button the js part gets executed and the div appends and more 'clause', 'sr.no.' and 'subclause' fields are added. I want the newly appended 'sr.no' field to get a value in it that is auto incremented from the previous field. How do I do that?</p>