I have a input text and a select tag in HTML. I input something in input tag and select text, but when I click select tag to select something, IE does not deselect text in input tag. Is this IE's specification? Can I use JavaScript to deselect text in input tag?
<input type="text" />
<br>
<select>
<option>aaaaa</option>
<option>bbbbb</option>
<option>ccccc</option>
<option>ddddd</option>
</select>
Found a solution.
window.document.onmousedown = mousedownControl;
function mousedownControl(e) {
e = window.event;
if (e.srcElement.nodeName == "SELECT") {
document.selection.empty();
}
}
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.