How can I change the text color with jQuery?

Jorge picture Jorge · Jan 4, 2010 · Viewed 376.3k times · Source

When I hover a text with animation definitely I will use jQuery. Is there a code that will change the color, or size?

Answer

Annabelle picture Annabelle · Jan 4, 2010

Place the following in your jQuery mouseover event handler:

$(this).css('color', 'red');

To set both color and size at the same time:

$(this).css({ 'color': 'red', 'font-size': '150%' });

You can set any CSS attribute using the .css() jQuery function.