change text color with a jQuery code


Posted on 16th Feb 2014 07:03 pm by admin

Hihow can I change the text in a asp:TextBox to a different color when I start typing using jQuery?I have this htmlview plaincopy to clipboardprint?
  1. Required.
    1. Required.

    2. and in a css file I have
      view plaincopy to clipboardprint?.text{color:Gray;} .text{color:Gray;}
      but when I type, I want the color to change to black instead of gray. the reason whey is because the Text attribute is being initially used as the box lable "Name:" in gray, and once I give it focus, it disappears.in a js file like this
      view plaincopy to clipboardprint?var $a = $("input[id$=name]"); $a.focus(function(event) { if ($a.val() == "Name:") { $a.val(""); } }); $a.blur(function(event) { if ($a.val() == "") { $a.val("Name:"); } }); var $a = $("input[id$=name]"); $a.focus(function(event) { if ($a.val() == "Name:") { $a.val(""); } }); $a.blur(function(event) { if ($a.val() == "") { $a.val("Name:"); } }); I tried the following which did not fix it.view plaincopy to clipboardprint?$("input").animate ({ color: "black" }); $("input").animate ({ color: "black" });
      thanks

      No comments posted yet

      Your Answer:

      Login to answer
      126 Like 19 Dislike
      Previous forums Next forums
      Other forums

      mysqli_fetch_assoc returns multiple arrays, how to return a single array
      Hello, I am using mysqli_fetch_assoc which is returning multiple rows, so it looks like:

      Code

      PHP Programming error. Please help!
      Hi there,

      Am making a website for a friend and have encountered a problem that i need fixing

      newbie question about multiple queries
      hi everyone,
      I'm sorry to ask such a basic question, but I'm young and trying to learn php on my

      Packet Design
      Hi All,
      Im new about network programming and I want to design a protocol but I have some question

      Header is not working in IE
      Hi ! header function is not working in IE but it works in FF, Safari, Chrome. any help please. :

      Why Are These Functions Causing MASSIVE Memory Problems? Please Help!
      Hi,

      I have a script with some options.

      I use regex to replace patterns in strings, but

      Multiple Dropdown Selections
      I have a form that let's a user insert a page with the ability to select categories. I want them to

      controlling/creating accounts with privileges
      hi all,
      i'm trying to figure out how i can create/control account with privileges, for instance a

      Just a white page
      Okay so, my website, when I click SignUp on it it takes me to /join.php but its a complete white pag

      tag inside php...
      hi


      Code: <?php
      echo "<td width="$columnWidth%" align=&

Sign up to write
Sign up now if you have flare of writing..
Login   |   Register
Follow Us
Indyaspeak @ Facebook Indyaspeak @ Twitter Indyaspeak @ Pinterest RSS



Play Free Quiz and Win Cash