开发者

Error deleting select options in internet explorer 8

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜