I have a select:
<select class="form-control" id="dataInstalacao">
<option value="0/0" selected disabled>Quando podemos instalar?</option>
<option value="6/9">6/9</option>
<option value="7/9">7/9</option>
<option value="8/9">8/9</option>
<option value="9/9">9/9</option>
</select>
I use the following code to add more options:
var newOption = new Option("teste", data.id, false, false);
$('#dataInstalacao').append(newOption).trigger('change');
What happens is that when I inspect the element, the new option is there, but what is displayed on the screen is a UL>LI
list and the select has display:none
and this list does not contain the new item
How do I proceed?