title: Add Dynamic name to input sequentially
body: <pre><code>&lt;tr&gt;
  &lt;td&gt;&lt;input name="of[1][dsn]" type="text" size="6" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][gc]" type="text" size="6" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][ys]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][ym]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][yl]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][s]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][m]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][l]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][xl]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][xxl]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][xxxl]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][xxxxl]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][xxxxxl]" type="text" size="3" /&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input name="of[1][total]" type="text" size="4" /&gt;&lt;/td&gt;
  &lt;/tr&gt;
  </code></pre>
  
  <p>I currently have this being cloned using jQuery and would like to have it to where the number in the "name" attribute is raised by +1 every time it is duplicated. "of[1][dsn]" to "of[2][dsn]" etc. How can I do this? Below is what I had tried to use, but that was flat out replacing what was already there. </p>
  
  <pre><code> ("input").each(function(index, element){$(element).attr("name", index);});
  </code></pre>
  
  <p>This is what I am using to actually clone the table row:</p>
  
  <pre><code>var clonedRow = $("table tr:last").clone();     
  $("table tr:last").clone(true).insertAfter("table tr:last").append(clonedrow);
  </code></pre>