4
How do I make list the checkbox values when the user select and when you are unselected the value does not appear in the list?
<select class="form-control" id="list-lugar">
<option value="0" disabled="true" selected="true">-</option>
<option value="200">1 Shopping</option>
<option value="200">2 Shopping</option>
<option value="100">3 Shopping</option>
<option value="100">4 Plaza</option>
<option value="100">5 Shopping</option>
<option value="100">6 Plaza</option>
</select><br><br>
<input id="add-buffet" type="checkbox" value="1000" />
<label>Buffet</label><br>
<input id="add-decoracao" type="checkbox" value="499" />
<label>Decoração</label><br>
<input id="add-foto" type="checkbox" value="800" />
<label>Foto</label><br><br>
<label>Lista</label><br><br>
item 1 R$200,00<br>
item 2 R$1.000,00<br>
item 3 R$499,00<br>
item 4 R$800,00<br>
Got it!! Sorry the question, I don’t know any javascript, and to take the value of options and checkbox and present in a div for example? It’s easy to do that?
– Jvs Corrêa
You may ask, we participate here to help us... before the
each
, creates a variable,resultado
for example... then creates thediv
withid='resultado'
for example.. in the code I put in place of theconsole.log
you can accumulate the values in a variable, thus:resultado += "Valor: " + $(this).val() + "<br /">;
After theeach
only play the variable ondiv
:$('#resultado').html(resultado);
and will appear the values selected indiv
– Ricardo Pontual