css - CSS3 color transition from transparent does not work for a textbox, how to solve? -


i posted following on chrome forum no luck, same problem exists -moz version of css3 rules.

i'm using chrome 12.0.742.122 on windows xp sp3. want use css3 transistion text in text box transparent color (red). starting css rule text in span , textbox no color style (i.e. default black) works both. starting transparent color style (or color), works span not text box, though rules complete analogous. following excerpt show problem. after clicking on button, first 2 text examples starting default colors, 1 in span , 1 in textbox, both turn red expected. second 2 text examples, again 1 in span , 1 in textbox, span text turns red , textbox text remains transparent.

how can textbox color transition transparent red?

example code showing problem:

<!doctype html> <html> <head> <meta http-equiv="content-type" content="text/html; charset=utf-8"> <title>change color test</title> <script type="text/javascript"     src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script> <style type="text/css">     .myclass1 {                    -webkit-transition: color 2s ease-in;     }     span#mytext1 input[type=text] {         -webkit-transition: color 2s ease-in;     }     .myclass2 {         color: transparent;         -webkit-transition: color 2s ease-in;     }     span#mytext2 input[type=text] {         color: transparent;         -webkit-transition: color 2s ease-in;     }     .newcolor {         color: red;     } </style> <script type="text/javascript">     $(function() {         $('#mybutton').click(function() {             $('.myclass1').addclass('newcolor');             $('span#mytext1 input[type=text]').addclass('newcolor');             $('.myclass2').addclass('newcolor');             $('span#mytext2 input[type=text]').addclass('newcolor');         });     }); </script> </head> <body> <span id="mytext1" class="myclass1">     hello world span 1!<br />     <input type="text" value="hello again text box 1!" /> </span> <br /> <span id="mytext2" class="myclass2">     hello world span 2!<br />     <input type="text" value="hello again text box 2!" /> </span> <br /> <input id="mybutton" type="button" value="click me change color" /> </body> </html> 

the .newcolor selector not specific enough override transparent declaration. if take out css transitions, still have same problem.

a quick solution be:

.newcolor {     color: red !important; } 

see http://jsfiddle.net/dfrgk/


Comments

Popular posts from this blog

linux - Using a Cron Job to check if my mod_wsgi / apache server is running and restart -

actionscript 3 - TweenLite does not work with object -

jQuery Ajax Render Fragments OR Whole Page -