[Fixed]-JQuery concatenate values as they are selected from a dropdown list

1👍

Use .join to concatenate array elements with a separator. And use .map to extract the email from each element of data.

success: function(data) {
    var mail = data.map(function(el) {
        return el.fields.email;
    }).join(',');
    $("#id_emailaddress").val(email);
}
👤Barmar

Leave a comment