How can I change the text color with jQuery?

JqueryText

Jquery Problem Overview


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

Jquery Solutions


Solution 1 - Jquery

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.

Solution 2 - Jquery

Or you may do the following

$(this).animate({color:'black'},1000);

But you need to download the color plugin from here.

Solution 3 - Jquery

Nowadays, animating text color is included in the jQuery UI Effects Core. It's pretty small. You can make a custom download here: http://jqueryui.com/download - but you don't actually need anything but the effects core itself (not even the UI core), and it brings with it different easing functions as well.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJorgeView Question on Stackoverflow
Solution 1 - JqueryAnnabelleView Answer on Stackoverflow
Solution 2 - JqueryProg ManiaView Answer on Stackoverflow
Solution 3 - JqueryJonahView Answer on Stackoverflow