The title attribute isn't stored in serializeArray
. You'll have to use .map
directly on $(".content :input")
function showValues() {
var tokens = $(".content :input").map(function() {
return (this.value) ? (this.value + ' ' + this.title) : null;
}).get();
$("#contentlist_copy").val(tokens.join(', '));
}
$("input").change(showValues);
showValues();