Skip to content

Instantly share code, notes, and snippets.

@ihorduchenko
Last active December 4, 2017 08:22
Show Gist options
  • Save ihorduchenko/9b12d82f7582f839d3454023e6ccbcb0 to your computer and use it in GitHub Desktop.
Save ihorduchenko/9b12d82f7582f839d3454023e6ccbcb0 to your computer and use it in GitHub Desktop.
Increment in WP loop
(function ($) {
var i = 1;
$("input[name=your-name], input[name=your-phone], input[name=your-email], textarea[name=cover-letter], input[name=file-attachment]").each(function () {
i++;
var curParentName = $(this).parents("form").attr("name");
var inputName = curParentName[curParentName.length-1];
console.log(inputName);
$(this).attr("name", $(this).attr("name")+inputName);
})
})(jQuery);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment