How to Hide and Show SELECT Options with JQuery in IE

前端 未结 3 759
后悔当初
后悔当初 2021-01-18 00:12

I\'m trying to hide some options from a drop down. JQuery\'s .hide() and .show() work great in Firefox and Chrome, but no luck in IE.

Any g

3条回答
  •  太阳男子
    2021-01-18 00:29

    I found a rather simple solution, although the options will not be hidden but disabled on IE.

    $('#delivery_time option[value="06:30"]').removeAttr('disabled').show();       // To Show/Enable
    $('#delivery_time option[value="06:30"]').attr('disabled', 'disabled').hide(); // To Hide/Disable
    

    Here is the source where I stumbled upon these 2 lines: IT Support Guides - Internet Explorer – How to hide select options using jQuery

提交回复
热议问题