I have a select2 drop down and would like to know the best way to SET a VALUE if the OPTION selected == ” Apple” for instance.
Here is my Select2
<select id="fruit" title="fruit" name="fruit"
class="form-control select2-single">
<option value=""> </option>
<option value="">Apple</option>
<option value="">Lemon</option>
</select>
What I’d like to achieve is:
If Option “Apple” is selected, SET Value to THISVARIABLE (I get responses from an AJAX Post and would like to dynamically set the Value