adding new elements to a select not always work in IE (jquery)
adding new elements to a select not always work in IE (jquery)
by Thulasi Ram.S
HTML
<select id="ddlTest">
<option value="a">a</option>
<option value="b">b</option>
<option value="c">c</option>
</select>
<input type=button value="Click Me!" id="btnUpdate" />
JavaScript
$(document).ready(function () {
var response = { 'data': [{ 'id': 'A', 'name': 'A' }, { 'id': 'B', 'name': 'B' }, { 'id': 'C', 'name': 'C' }, ] };
$('#btnUpdate').live('click', function () {
var returnElementId = "ddlTest";
$('#' + returnElementId).html('');
$.each(response.data, function (i, entity) {
$('#' + returnElementId).append($("<option />", { 'value': entity.id, 'text': entity.name }));
});
});
});