Styling the selection color of an input type=text, possible?

Posted by Tommy on Stack Overflow See other posts from Stack Overflow or by Tommy
Published on 2009-10-21T09:05:20Z Indexed on 2010/03/16 22:01 UTC
Read the original article Hit count: 223

Filed under:
|
|
|

Having an input

<input type="text" id="myTest" value="bla bla bla"/>

and doing this (using jQuery)

$('#myTest').select();

causes "bla bla bla" to be selected with default dark blue selection color.

Now, is there any way I can change this color using css? css3 can change selection using for instance

::-moz-selection {
  background: #ffb7b7;
}

but this only works on text in other elements, not in html inputs.

Any ideas?

/T

© Stack Overflow or respective owner

Related posts about css

Related posts about jQuery