jquery html attribute not working in IE
- by Gopal
I am using country and state dropdowns in my form. Whenever the user selects the country in the dropdown, the respective states of the country will populate in the states dropdown. I am populating the states in the dropdown using ajax call. The problem is that the states get populated in Mozilla but it doesnt work in IE. I guess there is some problem in jquery while loading the states in the states dropdown. The jquery code i am using is
$('select#edit-country').change(function(e) {
$.getJSON("loadContactUsStates",{id: $(this).val(), ajax: 'true'}, function(j){
var options = '';
for (var i = 0; i < j.length; i++) {
options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
}
<!-----I guess the problem is with the below line------------------>
$("select#edit-state").html(options);
})//end json
});