2
I got the following select
:
<select name="idservico[]" id="idservico">
<option data-valor="25,00" value="1">opção 1</option>
<option data-valor="20,00" value="1">opção 2</option>
</select>
I got the following input
:
<input type="text" name="valor" id="valor"/>
I got the following script
:
<script>
jQuery(document).ready(function () {
jQuery('#idservico').change(function() {
jQuery('#valor').val((jQuery(this).find(':selected').data('valor')));
});
});
</script>
So come on, when I select a service it sends the value of the service to the input
, but I need that when selecting another service - because my select
is multiple - it would have to add the value of the first selected to the second.
Can anyone help me? Be able to do until selecting and sending the value to the input
, but add nothing so far. Grateful.
See if this helps you.
– Ivan Ferrer