jquery html attribute not working in IE
Posted
by Gopal
on Stack Overflow
See other posts from Stack Overflow
or by Gopal
Published on 2009-01-05T10:18:54Z
Indexed on
2010/04/13
11:32 UTC
Read the original article
Hit count: 359
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
});
© Stack Overflow or respective owner