I am trying to consolidate all inputs on my form into one string, but my code just overwrites the var on each loop leaving me with only the text from the last input on the form… How can I fix this?
$(':input').each(function() {
var output = $(this).val();
$('#output').html(output);
});
Or you could also use the
.map()function: