Aug 22, 2017 · 1 min read
Thank you for this.
var newPost = ""; // Inputted values// Iterate through the inputs
$("input").each(function() {
newPost += $(this).val() + ",";
});// Get rid of the last comma
newPost = newPost.substr(0, newPost.length - 1);
can be replaced with:
var newPost = $("input").map(function () { return $(this).val() }).toArray().join(',');