I need to get the values of a $ ('select [multiple]'). val () separated by a comma. For example.
HTML code:
<select id="estado" multiple>
<option selected>SP</option>
<option selected>RJ</option>
<option selected>ES</option>
<option>MG</option>
</select>
JavaScript code with jQuery:
const estados = $('#estado').val(); //Resultado: SPRJES
How to make states return to be "SP, RJ, ES" if they were selected?
You're returning everything together.
Thank you