dropdown width increases in IE11 when focus is in textbox with a placeholder

南楼画角 提交于 2019-12-10 08:43:41

问题


When the focus is in the <input> and I click on the <select> dropdown then the dropdown's width is increased. I tried to set the width on focus to 100%, but that's not working.

This is my html:

<html>
<body>
  <select>
    <option value="volvo">Volvo</option>
    <option value="saab">Saab</option>
    <option value="opel">Opel</option>
    <option value="audi">Audi</option>
  </select>
  <input type="text" placeholder="hello" />
</body>
</html>

回答1:


Add the onmousedown attribute and have it focus on the select dropdown so that it loses focus from the input box. For some reason focus on the input before accessing that select causes this error.

<select onmousedown="$(this).focus()">



来源:https://stackoverflow.com/questions/26802752/dropdown-width-increases-in-ie11-when-focus-is-in-textbox-with-a-placeholder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!