Hi All,
The textbox name: q able to transform become select field when some function trigger. But, I failed to populate the option into the new select field. How can I do that?
Something wrong with this code:
var options = $(this).closest('div').find("select[name^='q']");//what should I need to do here???
var plazosHtml = "";
var controller = $(this).val().split('.')[0];
var html = "<select id='q' name='q'></select>";$(this).closest('div').find('#q').replaceWith(html);$.ajax({
url: '@Url.Content("~/Admin/CurrencyList/")',
type: 'POST',
dataType: 'json',
success: function (data) {
var options = $(this).closest('div').find("select[name^='q']");//what should I need to do here???$.each(data, function () {
//alert(this.Description); // came from .NET Dictionary's Key Value pair
options.append($('<option />').val(this.CurrID).text(this.Description));
});
}
});
} else {
var html = "<input type='text' size='30' id='q' name='q' class='qsbox' />";$(this).closest('div').find('#q').replaceWith(html);
}Please advise.
Regards,
Micheale