title: Increment function parameter value onclick in jquery
body: <h2>What I Require</h2>
  
  <p>I want to Increment function parameter value onclick in jquery.I have an input field which on button click creates a clone of itself. The field contains an onclick function. The default id of the text field is t1 and on each button click the id increments its numeric value ie: t2,t3,t4...... I am passing the numeric part as a parameter in my onclick function also. But I am not able to increment the parameter.</p>
  
  <h2>Script (For incremeting the ids)</h2>
  
  <pre><code>function fixIds(elem, cntr) {
     $(elem).find("[id]").add(elem).each(function() {
         this.id = this.id.replace(/\d+$/, "") + cntr;
     })
  }
  
  
  function addRow() {
   var count = parseInt($('#counter').val(), 10) + 1;
   var table = $('#matBody tr').first().clone();
   fixIds(table, count);
   table.appendTo('#matBody');
  
  }
  </code></pre>
  
  <p>The count gives the value of previously added numeric value.</p>
  
  <h2>HTML</h2>
  
  <pre><code>&lt;input type="button" id="add1" class="add" value="+" title="Add" onclick="addRow(1);"/&gt;
  </code></pre>
  
  <p>Here I am able to increment the id from add1 to add2.... But I want the onclick parameter value also to be changed.</p>