1
Good afternoon, I have the following question:
I have a select field with about 100 options. In this current select, I choose an option and this chosen option is filled in a new input text...
I wanted to put a "More" button and when clicked create a new input text field... now my question: is possible using the same select I make a new choice and fill this new field without losing what was filled in the previous?
I did some research and I couldn’t find anything that would do that, so if someone could give me a hint on how to make this happen, it would really help me out.
Example:
<select class="form-control" id="frutas" name="frutas" autofocus >
<option value="">Selecione...</option>
<option value="Maca">Maça</option>
<option value="Uva">Uva</option>
<option value="Morango">Morango</option>
<option value="Banana">Banana</option>
</select>
And my job:
$('#frutas').change(function () { $('#nome_fruta').val($('#frutas option:selected').text());
});
In the example above, I choose a fruit and it fills an input with the value of select. Now I wanted to put a button to create a new field to receive another fruit from the select.
Att
Are you using any framework (pure javascript, angular, React?) Also I could not visualize very well what you need, if you have any drawing would help to understand better.
– lfarroco
@I’m using bootstrap and jquery.
– AmandaRJ