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

      What is SAP Avatar ?
      Hi All,

      This G.Satish , my boss asked me to explore on SAP Avatar. I searced in internet

      Hashing?
      Hi, I was hoping to take a string value then convert it - consistently - across each of our pages in

      Creating an invoice
      Using fpdf I am trying to create an invoice to send to clients. The products are sold in pricing tie

      Forum tutorial
      Im a beginner in PHP. Im making a forum(previous questbook, counter and few others) to learn. For no

      Get Total From While Loop
      I'm trying to get the total for each product and add them for a Grand Total to list outside the loop

      disable all input buttons
      Hello Friends,

      suppose i do have a file ( file.php ) has a submit button

      Code: [Sele

      php forms and database navigatio
      Hello,
      I'm new to php and i'd like to post the following.
      I have written code to get records f

      CURL question
      i am wondering if it's possible to use multi curl with login something like

      login once to web

      Dealing with code in db query
      I am dealing with C code and I need to make sure it is encoded some how to ensure its integrity and

      Mysql error message
      help me find out what this error message means:

      "Duplicate entry '0' for key 'PRIMARY'&q

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