0

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"); 
    });
});

});

Mark Henry
  • 2,649
  • 7
  • 40
  • 48

1 Answers1

1

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()

Community
  • 1
  • 1
MarioRicalde
  • 9,131
  • 6
  • 40
  • 42