jQuery: animate text color for input field?

21,345

Solution 1

jQuery doesn't support color animations so you'll need the color plugin or, jQuery UI. Both allow you to use the syntax you're using for properties like background-color and color.

Solution 2

You can do this without the color plugin. I've answered this question here.

Solution 3

To animate color you need the jquery color plugin.

Share:
21,345

Related videos on Youtube

Admin
Author by

Admin

Updated on April 20, 2020

Comments

  • Admin
    Admin about 4 years

    I've got this really simple piece of code that I thought was the correct way to get jQuery to animate the text color for a given input field.

    $('input').animate({color: '#f00'}, 500); 
    

    But it won't work. However, I can change the text color:

    $('input').css('color', '#f00'); 
    

    I've tried this in both Safari 4 and Firefox 3.5 with the same (lacking) results. I'd really appreciate any input on this problem as I'm running out of hair... Thanks.

  • redsquare
    redsquare over 14 years
    Including jQuery-ui is a hefty include just for a color animation!
  • n1313
    n1313 over 14 years
    And you can learn about this on the first page of google search google.ru/search?q=jquery+animate+color