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

      Question about GD library
      I am trying to make an image that shows a random quote from my database.


      However I want t

      have trouble in a if condition
      The if below is working ok, it check when indexes, name, zipcode and state are empty.
      Code: &

      Warehouse Management
      Hi,

      On our system, we have two storage locations ( A and B ) where A is the main factory

      Help with setcookie()
      Merry Xmas to those on this foruum
      Older guy here with some experience but not allot so please be

      rookie looking for help coding a CSS form with PHP
      I'm trying to figure out how to add PHP code to my xhtml form so that it is a working form embedded

      Looking for help on using joining mysql tables and php....
      Does anyone have any good links to references on how to pull mysql data, through joining tables and

      ORA-01655: unable to extend cluster SYS.C_FILE#_BLOCK# by 128
      Hi all,

      Oracle 10g. Linux.

      I'm facing the below error while trying to import a dumpfil

      PHP Display Telephone Number On Referrer
      I have used the php below to show a different telephone number in the header of the site depending u

      If statement help please.
      Hello on my site I have 2 content boxes. 1 is for the main content (which is the biggest one) and th

      How to clone an SAP ECC using bacup tape on z/os?
      We want to clone our production to a different SID using backup tape.

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