更改文本字段中的文本颜色 [英] Change text color in text field
本文介绍了更改文本字段中的文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个输入文本字段,默认情况下它的值是something,但是当我开始输入时,我希望默认值更改颜色,并输入另一个文本。
I have an input text field, which has a value "something" by default, but when I start to type, I want that the default value changes color, and the text i'll type, another one.
我该怎么做?
How can i do that?
<input type="text" value="something" onclick="this.value=''" />
推荐答案
保持简单>
To keep it simple like your example:
<input type="text" value="something" onclick="this.value='';this.style.color='red';" />
而且这应该可以做到。
这篇关于更改文本字段中的文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文