I had an excellent function to populate a resort dropdown box after selecting the country. Now, with jquery 1.6 the resort dropdown box is not populated anymore. Does anyone knwo what is causing it.
function populate_country() {
$.getJSON('/v3/ajax/fetch_resort.php', {country:$('#country').val()}, function(data) {
var select = $('#resorts');
var options = select.attr('options');
$('option', select).remove();
$.each(data, function(index, array) {
options[options.length] = new Option(array['resort']);
});
});
}
$(document).ready(function() {
$("#country").click(function(){
// populate_country();
$('#country').change(function() {
$loading.show();
populate_country();
$("#resorts").show("fast");
});
});
});
To me it seems like it has to do with the fact that attr
changed. Try using prop
instead.
Check more about it here: .prop() vs .attr()