Created
October 30, 2012 13:30
-
-
Save iSWORD/3980194 to your computer and use it in GitHub Desktop.
HTML+JS Chrome editable select element
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
.select-editable { position:relative; background-color:white; border:solid grey 1px; width:120px; height:18px; } | |
.select-editable select { position:absolute; top:0px; left:0px; font-size:14px; border:none; width:120px; margin:0; } | |
.select-editable input { position:absolute; top:0px; left:0px; width:100px; padding:1px; font-size:12px; border:none; } | |
.select-editable select:focus, .select-editable input:focus { outline:none; } | |
</style> | |
<div class="select-editable"> | |
<select tabindex="-1" onchange="this.nextElementSibling.value=this.value"> | |
<option value=""></option> | |
<option value="115x175 mm">115x175 mm</option> | |
<option value="120x160 mm">120x160 mm</option> | |
<option value="120x287 mm">120x287 mm</option> | |
</select> | |
<input type="text" name="format" value="" onkeydown="if(event.which==40){e=document.createEvent('MouseEvents');e.initMouseEvent('mousedown');this.previousElementSibling.dispatchEvent(e);return false;}"/> | |
</div> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment