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

      Help With Showing Users On the Index Page
      Ive got this code which works just how i want it to.

      Code: <?
      $timenow=time();

      Random Number Generation And Probability
      Hello, I am working on a function which has to insert data into a SQL table.

      we have to suppl

      drop-down with sub-category appear
      Hello,

      i know how to build a simple dro-down list, im looking for a code when im gonna choose

      IP question
      ive got 2 ip addresses both global from same user how would i detect if they are local to each other

      Read from a text file after a specific word
      Hi all.

      I have a text file that looks like the one below.
      I know how to open the text fi

      Sub-domains & calling unique content
      Hello,

      Is there a way use something similar to the $_GET function for a sub-domain? I to be a

      Linux socket programming
      Where can I find a good introduction to socket programming?

      PHP and MySQL on intranet?
      Is it possible to use both these on an intranet network?

      How to Handle more than one submit button in single form?
      Hi
      I have one PHP file which contains one Form. In this form there are two Submit type Buttons

      Displaying values from a SQL count...
      Hi,
      Easy enough question i just forget the exact method ..
      I have ...

      Code: //count win

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