title: How to Dynamically set the index of array in the name attribute of the input field using Javascript
body: <p>How to Dynamically set the index of array in the name attribute of the input field using javascript? </p>
  
  <pre><code>&lt;input type="text" name="item[][name]"&gt;
  &lt;input type="text" name="item[][description]"&gt;
  &lt;input type="text" name="item[][brand]"&gt;
  </code></pre>
  
  <p>If I add thesame set of input fields or duplicate it using javascript  the result should be like below: </p>
  
  <pre><code>&lt;input type="text" name="item[0][name]"&gt;
  &lt;input type="text" name="item[0][description]"&gt;
  &lt;input type="text" name="item[0][brand]"&gt;
  
  &lt;input type="text" name="item[1][name]"&gt;
  &lt;input type="text" name="item[1][description]"&gt;
  &lt;input type="text" name="item[1][brand]"&gt;
  </code></pre>