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

      Using Microsoft Exchange Server with PHP
      Hi,

      I wanted to know if its possible to fetch email attachments from the exchange server usin

      natcasesort works on one server but not on another
      Hi

      I have a problem that I was hoping that someone can help me with.

      I'm trying to use

      Simple code help with redirects
      I am trying to figure out a redirect script that detects if the browser is IE 7 and if it does, redi

      max() problem
      I have a while loop to get image names.
      Code: $imagequery = mysql_query("SELECT * FROM ad_i

      Inserting into MySQL Newbie
      Hi ive got a slight problem where ive made a simple web form where the customer inserts the ammount

      PHP Programming error. Please help!
      Hi there,

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

      Generating unique numbers using php
      Hi,
      I need help in generating unique number using php.I tired using rand() in php.But, by using r

      Can't seem to capture a variable in a chained select
      I'm *this* close to having a chained select running but for some reason it doesn't seem to be pickin

      Find current logon time
      Hi,
      in my sql script i want to query and find out the logon time of the current session.
      <

      Find occurences of unicode characters in string
      I need to prohibit filenames with everything but English characters and numbers but regexp and strin

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