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

      Output Full URL of Current Page
      Let's say I am currently viewing a dynamic page:

      http://www.mydomain.com/directory/index.php

      An odd assignment statement. Can someone explain this assignment to me?
      What purpose is served by the bit of code between the two equal signs in the $installurl set? Is th

      Filtering for a phrase using pregmatch
      Here is my code which looks for addresses which start with ' src=" '

      Code: [Select]preg_

      Displaying an image using echo command
      I had done a query on my database, one of the fields being an image reference to a directory where a

      form variables from database help.
      Hi all,

      I would like to have a form that gives you options based on the results of an mysql q

      php ajax - two drop down list with a submit button
      i have created a form with 2 drop-down list and a submit button. I would like to know how to pass th

      temporary objects
      Until now i thought every temporary object in C++ is created as constant. I'm wondering why my compi

      Inserting Data into a MS Access DB using PHP.
      As part of my uni course I am doing a placement at a company whom want me to create a client zone fo

      file_put_contents and createimagefromjpeg
      All,
      I do somethings and then I have the following code:
      file_put_contents('./test/'.$filename

      License Issue - service type user
      Hi,

      I would like to understand the following issue regarding sap license.
      I wish to

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