My solution is very simple, it looks like a native editable combobox and even works in IE6 (some answers here require a lot of code or external libraries, and the result is, for example, the text in the text box follows the drop-down icon of the combo box part or it does not look like an editable one combo box).
The goal is to copy the combobox so that only the drop-down icon appears above the text box. And the text box is a little under the combobox part, so you do not see its right end - it continues visually with combobox: https://jsfiddle.net/dLsx0c5y/2/
select#programmoduleselect { clip: rect(auto auto auto 331px); width: 351px; height: 23px; z-index: 101; position: absolute; } input#programmodule { width: 328px; height: 17px; } <table><tr> <th>Programm / Modul:</th> <td> <select id="programmoduleselect" onchange="var textbox = document.getElementById('programmodule'); textbox.value = (this.selectedIndex == -1 ? '' : this.options[this.selectedIndex].value); textbox.select(); fireEvent2(textbox, 'change');" onclick="this.selectedIndex = -1;"> <option value=RFEM>RFEM</option> <option value=RSTAB>RSTAB</option> <option value=STAHL>STAHL</option> <option value=BETON>BETON</option> <option value=BGDK>BGDK</option> </select> <input name="programmodule" id="programmodule" value="" autocomplete="off" onkeypress="if (event.keyCode == 13) return false;" /> </td> </tr></table>
(Used initially, for example, here, but do not submit the form: old.dlubal.com/WishedFeatures.aspx)
EDIT: the styles should be a little different for macOS: Ch โโin order, since FF increases the height of the combobox, Safari and Opera ignore the height of the combobox, therefore increase their font size (has an upper limit, and then decrease the โbit heightโ text box): https://i.stack.imgur.com/efQ9i.png
Ladislav Zima Apr 07 '17 at 12:54 on 2017-04-07 12:54
source share