hide() not working in IE

前端 未结 6 428
你的背包
你的背包 2021-01-25 19:31

My code works perfect in firefox and gives error in IE. any ideas?

I have a dropdown with various options, I am trying to show/hide options in another dropdown based on

6条回答
  •  旧时难觅i
    2021-01-25 20:03

    It won't work in IE & Chrome

    check out in IE or Chrome

    The best alternative that you can do is to remove the option rather than hiding it.(you should keep a copy of the original options before removing it.)

    var copy = $("."+Name).clone();
    function selectNames() {
       $("#thefirstselect option").remove();
       copy.appendTo("#thefirstselect");
       var Name = $("#SelectName").val();
    
       $("."+Name).each(function() {
          $(this).remove();            
    });
    }
    

提交回复
热议问题