I am using the following code to change the color of text but it is not working.. Can anyone help me with this? the soloution in javascript or jquery anything is fine..
I've created a pretty short fiddle that demonstrates the use of jQuery to change the color of a piece of text.
HTML:
Sed ut perspiciatis unde omnis iste natus error sit voluptatem accusantium doloremque laudantium?
CSS:
#paragraph {
color: green;
}
JavaScript:
$('#colorChanger').click(function() {
$('#paragraph').css('color','black');
});
The code above shows that with any text you can change the color using jQuery's css method. Additionally, I used #paragraph to access the paragraph; however, you can use nth-child through jQuery, you can cycle through the children of a container using a loop and checking for the right one then using the css method from jQuery. These are just a few of the ways to change the color of a piece of text.