blob: 73fac822338c73ef14448ebf4229327c081fcb65 [file] [log] [blame]
<!DOCTYPE html>
<style>
::selection { background-color: rgba(63, 128, 33, 0.95); color: yellow; }
</style>
<input id="inputText" type="text" value="Hello" style="border:5px solid; width:100px; font-size:16px; font-family:sans-serif; padding:0; margin:0; outline:none;"><br>
<br>Fix for ::selection pseudo element to work on input elements.
<br>The above selected text in the input box should have green background and yellow color.
<script>
document.getElementById('inputText').select();
</script>