views:

44

answers:

3

Can the color of this text be changed as it is inputted by the user in the text box through css only..

<html>
<head>

</head>

<input type="text" id="name1" name="name1" />
A: 

I've not tested, but wouldn't it just be:

input {color:blue}
Kin
Note, I think id-"name1" should be id="id1". note the equals sign. Also ina number of cases ID and NAME share the same namespace and so can't be the same.
Jaydee
+1  A: 
input:focus {color:blue}
danixd
A: 

I'm getting your question like this: You want to change the text color in text box to the color name that has been typed into that text box.

if my interpretation is right then, following jQuery snippet will do the thing:

$("#name1").css("color", $("#name1").text());
Abhijeet Pathak