Hide select option Cross Browser

Posted by Tapas Bose on Stack Overflow See other posts from Stack Overflow or by Tapas Bose
Published on 2012-11-23T16:49:27Z Indexed on 2012/11/23 17:04 UTC
Read the original article Hit count: 286

Isn't there any way to do it?

I have made jsFiddle which is not working in IE.

The piece of code is given below:

The HTML

<select id="testing">
    <option value="1">Option 1</option>
    <option value="2">Option 2</option>
    <option value="3">Option 3</option>
</select>

The jQuery

$(document).ready(function() {
    $('select#testing option').eq(1).attr({
        disabled: 'disabled'
    });
});

The CSS

select option[disabled] {display: none;}

Any pointer would be helpful.

Note: I cannot use .remove() method.

© Stack Overflow or respective owner

Related posts about JavaScript

Related posts about jQuery