简体   繁体   中英

Css select drop down menu issue with ie9

I am having an issue with drop down menu in ie9. The below code is working fine for me. But on ie9 i have to click twice on the dd menu to see the options.

any solution for ie9?

<script type='text/javascript'>
    function SetWidthToAuto(drpLst) {
        drpLst.style.width = 'auto';
    }

    function ResetWidth(drpLst) {
        drpLst.style.width = '150px';
    }
    </script>

    <div style="width:150px;overflow:hidden;">
    <select id="drpTechnology" style='width:150px' onchange='ResetWidth(this)'
    onblur='ResetWidth(this)'
    onmousedown='SetWidthToAuto(this)'>
    <option value="-1">Browse me..</option>
    <option value="1">Short Option</option>
    <option value="2">Little bigger than short Option</option>
    <option value="3">Largest option available with this select box</option>
    </select>
    <div>

Thanks

Just replace onmousedown by onclick .

You can also remove this in the function calls and simply use this inside the functions.

Try the JSfiddle: http://jsfiddle.net/d2UUs/1

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM