View Full Version : trouble changing color of text inside form

Jul 9th, 2010, 06:13 PM
I am new to this stuff, so I apologize if I do not use the correct terminology.

I have a form that automatically displays "Enter your email" when loaded.
When you click in the form, this value is removed.

I am using this code:

<input type="text" name="email" size="30" maxlength="40" value="Enter your email address" onfocus="if(this.value==this.defaultValue) this.value='';" onblur="if(this.value=='') this.value=this.defaultValue;" />

I want the original "Enter your email" to be gray, but the text they enter to be black.

When I use the code below in the CSS, it changes the "Submit" button to gray as well. I don't want the submit button to be gray, I want it to stay black!


I thought about changing the submit button to an image, but I figured I would ask here first.

Thanks in advance

Jul 9th, 2010, 06:26 PM
Add a class or id to your input element, like

<input type="text" class="text" name="email" size="30" maxlength="40" ..../> and use a specific selector, like