0
Good afternoon to all.
I need some guidance from you regarding select Multiple.
I have the select below:
<select class="form-control" id="dias_semana" multiple name="diasDaSemana[]" required>
<option value="">Selecione...</option>
<option value="Domingo">Domingo</option>
<option value="Segunda">Segunda-Feira</option>
<option value="Terca">Terça-Feira</option>
<option value="Quarta">Quarta-Feira</option>
<option value="Quinta">Quinta-Feira</option>
<option value="Sexta">Sexta-Feira</option>
<option value="Sabado">Sábado</option>
</select>
Through the above select I am able to select more than one option and send to the bank.
My difficulty is to present the data that is in the database.
I was trying to do this:
$("#dias_semana").val(diasDaSemana[]);
But it didn’t work.How can I do this?
Could you clarify what is the
diasDaSemana[]
? In javascript this means nothing unless it is a variable and the[]
at the end will cause an error. I might think that your goal would be to select the last item of the arraydiasDaSemana
, or even catch the element with name=daysDaSemana. Could clarify, so I can help you better.– Filipe Teixeira
@Filipeteixeira is a variable yes.... also can not explain, because I took this from the net and worked to save in the bank... the problem is to take the bank and show the user what was saved... for example.... select Sunday... there on my edit screen... this select option Sunday, would have to be marked. Here I am strolling
– AmandaRJ