JSFiddle - React, Tailwind, and code Playground
HTML
<input name="field[0]" />
<select name="field[1]" />
JavaScript
$("input, select").attr('name', function(i, val) {
return val.replace(/\d+/, function(n) {
return ++n;
});
});
alert($("input")[0].name);
alert($("select")[0].name);