Allow multiple fields to be incremented properly

I've wrapped the $input in an each loop to capture all the fields that would be cloned and this would make way to multiple fields being cloned properly in terms of name and id field.

Initially, the current javascript code treats multiple fields to have the same input name and id.

So if there is this fields:
<pre>
&lt;input type="text" name="field[0][url]" value="" /&gt;
&lt;input type="text" name="field[0][name]" value="" /&gt;
</pre>

If cloned, it would end up like this:
<pre>
&lt;input type="text" name="field[1][url]" value="" /&gt;
&lt;nput type="text" name="field[1][url]" value="" /&gt;
</pre>


The above proposed fix will fix this issue.