I have a list of properties of which each has a reference number and I am trying to separate each reference by a comma then set them for a input field value, I am unsure if its the correct way to do it, however I am receiving a [object Object] message, my code is:
var propertyRef = $( ".reference" ).clone().append(',').contents();
$('#propertyRef').val(propertyRef);
var propertyRefs = []; $(".reference").each(function() { propertyRefs.push($(this).text()) }); var propertyRef = "Shortlist: " + propertyRefs.join(', '); console.log(propertyRef); //$propertyRef.appendTo('#propertyRef');although the code seems a lot better than what i had :)