Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6699275
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T06:40:33+00:00 2026-05-26T06:40:33+00:00

How do I change the p tag text color css attribute using jQuery? I

  • 0

How do I change the p tag text color css attribute using jQuery? I don’t want to change all p tags, just a particular one….

Is this possible without adding an id for every p tag?

<div class = "custimage"><img src = "img/notch.jpg" alt = "notch"/><p>Notch</p></div>
<div class = "custimage"><img src = "img/peak.jpg" alt = "peak"/><p>Peak</p></div>
<div class = "custimage"><img src = "img/shawl.jpg" alt = "shawl"/><p>Shawl</p></div>

EDIT:

I want it so that when the user clicks on a particular custimage, the p tag text color is changed. I have tried:

$('.custimage').click(function(e) {
               var cssObj = {
                  'background-color' : '#fff'
               }
               $(this).css(cssObj);
               $('this p').css({color: '#000'});
});

This doesn’t work. Using $('.custimage p').css({color: '#000'});changes the colour of the text in all the images…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T06:40:34+00:00Added an answer on May 26, 2026 at 6:40 am

    You should be able to change the color of the p tag inside the clicked .custimage div like this:

    $('.custimage').click(function(e) {
        $(this).find('p').css({color: '#000'});
    });
    

    The .find() function traverses down the DOM tree to find any tag that matches the given selector. You can read more about the .find() function at http://api.jquery.com/find/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm learning css and trying to change background-color of all html except one div
I'm using jQuery to change the HTML of a tag, and the new HTML
I don't want to change the java code whenever there is addition of tag
I'm trying to fade the background-color of a span tag using JQuery to emphasize
how to change the color of the text indicator of tab? i can change
One of the parameters in the script tag may change dynamically - djConfig=parseOnLoad:true, locale
I want to change the background-color of the body of my HTML document. My
HI All, I want to know how to style an anchor tag(eg: need to
Using CSS it's easy to apply a custom color to a link when you
I have a link in a div, I want the link color change to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.