I have select
with the following values in option
:
<select id="frutas" name="frutas" >
<option value="">Selecione...</option>
<option value="Maçã - 10.00"> Maçã </option>
<option value="Banana - 15.00"> Banana </option>
</select>
When selecting an option, the data is populated in a text
field with ID: nome_preco
:
<input type="text" id="nome_preco" name="nome_preco" value="" />
I need to fill in another field but only with the price of the fruit:
<input type="text" id="preco" name="preco" value="" />
So if I select " Maçã
", my fields would be populated with the data:
Fruit: Maçã - 10.00
Value: 10.00
How can I do this? Would it be possible to do this using jQuery? can you help me? Thank you