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 mysql_error()
      Hi,

      I am trying to insert data into a table, but I am not able to insert it. I wanted to see

      Values disappear from my array :( HELP!
      hey all, I have a lil mysql/php/apache script that queries a database
      and pulls put 5 integers.

      User registration and login
      I don't know whether this is the correct forum, if not i apologise but am pretty desperate at the mo

      Amatuer requiring assistance
      Beginner and amateur in need of assistance

      My Site - (Spare Parts for Domestic Appliances)

      Best PHP Documentation generator
      Hello guys!

      I would like to hear from you what is the best PHP documentation generator. Perso

      While Problem
      i am having a problem with a while statement here is the code
      Code: [Select]<?php
      sess

      include
      Hi I have this way of licensing my PHP application, and I want to know if you guys can answer some q

      Need help with a mail notify function
      I was tasked with setting up a site that's been prewritten. The site is basically a form that captur

      Need help to modify php ELSE code
      I'm trying to find a way to have the php code display a message if there is no inventory listed in t

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

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