-8
I need to receive the values of a comma separated $('select[Multiple]'). val(). For example.
The 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 the return of states to be "SP, RJ, ES" if these were selected?
It’s all coming back together.
Thank you
As the return is now?
– Erlon Charles
Explain better what you want to do, show more code. Give an example of an entry and what would be the desired result.
– gbvisconti
Erlon, I applied to a select of multiple choice, it returns everything together, SP,RJ,ES,MG, I need a space between them, e.g.: SP, RJ, ES
– Munir Baarini
They denied my question why? If it’s so banal why didn’t they help me?
– Munir Baarini
Speak, friend. I improved the writing of your question. Ended up annoying some rsrsrs. I put the answer you need. Look there.
– Sergio Cabral
Thanks again Sergio, I tried to be brief, I did not think the question was poorly asked, but with its edition got better! Thanks!
– Munir Baarini