开发者

Error deleting select options in internet explorer 8

开发者 https://www.devze.com 2023-02-16 18:31 出处:网络
Its working in Firefox but in Internet Explorer the select(dropdown) just hide from the page when getJSON return from action. This is my code

Its working in Firefox but in Internet Explorer the select(dropdown) just hide from the page when getJSON return from action. This is my code

  $.getJSON("/Post/GetResourcetype", {}, function (data1) {
            $($("#ddResourcetype").attr("options"), $("#ddResourcetype")).remove();            
            $.each(data1, function (key, value) {                
                var arrkey = new Array();
                arrkey = key.toString().split('_');
                $('#ddResourcetype').append('<option value="' + value + '" name="' + arrkey[1] + '">' + arrkey[1] + '</object>');
            });
        });

what is the issue in following code.

When i comment $($(开发者_JAVA百科"#ddResourcetype").attr("options"), $("#ddResourcetype")).remove();

It works fine


I change this line of code

$($("#Parent").attr("options"), $("#Parent")).remove();

to

 $("#Parent").empty();

For deleting previous value of select and now its working fine in both browsers


at the end of object instead of option

$('#ddResourcetype').append('<option value="' + value + '" name="' + arrkey[1] + '">' + arrkey[1] + '</object>');

it should be

$('#ddResourcetype').append('<option value="' + value + '" name="' + arrkey[1] + '">' + arrkey[1] + '</option>');
0

精彩评论

暂无评论...
验证码 换一张
取 消