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

      TemplatePower & AJAX
      Hi all,



      I'm currently implementing some AJAX features in my PHP-framework (which is b

      Help Import Animoto and Youtube
      CAn someone help me urgently want to allow users on my website to import youtube/revver/dailymotion

      Displaying returned XML in another PHP page
      I have an online payment form that will return XML given if a payment is successful or declines. I

      Shuffle Array
      Hi,

      I am writing a script for a game that needs players to randomly be assigned a target (ano

      Class not found error
      I am getting Class 'index' not found in Eval function:

      //write config

      $pat

      Implementing Single Sign-On using SAML 1.1, x.509, LDAP in C#.net
      Hi, I got a requirement from the client i.e implementing single sing on using SAML 1.1( LDAP &

      Schedule editor
      Hi,

      I have a question related to Schedule editor.
      If we schedule a BLS for every 30

      Help If user voted, block them
      On my Prayer request site, i let users Click a button to Pray for somone that has posted a pray, i g

      PHP hyperlinks generator
      Hi

      I need some help to get this done using php:


      1 - I have few hyperlinks say 500

      Just wondering what you think about my site
      I am new to phpfreaks i just seen this form and thought it would be cool to see what other thought a

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