The problem is that ::-ms-expand
is a pseudo-element, and thus technically doesn't exist in the DOM. In terms of a JavaScript solution that doesn't require any CSS support, your only option would be to dynamically inject the desired rule into the stylesheet via JavaScript's addRule
:
$('select').css('::-ms-expand', 'none');
if (navigator.appVersion.indexOf("MSIE") !== -1 || navigator.appVersion.indexOf("Trident") !== -1) {
document.styleSheets[0].addRule('select::-ms-expand', 'display: none;');
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<select>
<option>1</option>
</select>
Note that the addition of the rule will throw a warning on Chrome and Firefox, but will work in Internet Explorer. As such, you should also confirm that the user is running Internet Explorer by checking against MSIE
and Trident
in their navigator.appVersion
.
Hope this helps! :)