I have a select
field that is populated with data after a callback succeeded and I need to call a function when this happens.
I tried to use the jQuery on .change
but this is fired only after I select another option, not when the select field is populated.
Is there a way to dynamically check if a select
field gets some values?
This is what I've done so far:
$('select').on('change', function() {
// Do something
});
This is how I populate my select list (I'm using google apps script):
function onMetricsSuccess(selectList) {
$.each(selectList, function(key, value) {
$('select')
.append($("<option></option>")
.attr("value",value)
.text(value));
});
}