I have a select list, where you can choose multiple cities – When choosing a city, i wanna add the Zipcode to a hidden field, the solution i have now inserts the value to the hidden field, however, it overwrites the value when fx: clicking a new city – It should just append to the value, like: value=”value1|value2|value3″
$jq('.select-cities').click(function () {
var zipcodeValue = $jq(this).val();
//alert(zipcodeValue);
$jq('.hiddenFieldChosenAreas').val(zipcodeValue);
$jq('.select-cities option:selected').appendTo('.chosen-cities');
});
Try this: