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

  • SEARCH
  • Home
  • 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 9136285
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T08:55:58+00:00 2026-06-17T08:55:58+00:00

OK, this is the basic layout. <div class=products> <div class=product_item> <a href=#> <div class=item_title>Unique

  • 0

OK, this is the basic layout.

<div class="products">
    <div class="product_item">
        <a href="#">
            <div class="item_title">Unique Title 1</div>
            <div class="item_price_box">
                <p class="item_price">
                    <span class="item_price_label">Price</div>
                    <span class="item_price_text">$265</div>
                </p>
            <div>
        </a>
    </div>
    <div class="product_item">
        <a href="#">
            <div class="item_title">Unique Title 2</div>
            <div class="item_price_box">
                <p class="item_price">
                    <span class="item_price_label">Price</div>
                    <span class="item_price_text">$550</div>
                </p>
            <div>
        </a>
    </div>
    <div class="product_item">
        <a href="#">
            <div class="item_title">Unique Title 3</div>
            <div class="item_price_box">
                <p class="item_price">
                    <span class="item_price_label">Price</div>
                    <span class="item_price_text">$995</div>
                </p>
            <div>
        </a>
    </div>
    ...
</div>

I need to select only the “product_item” that contains “item_title” that contains the text “Unique Title 2”.

Then I need to add a class to that “product_item” only, and add some HTML into the “item_price_label” of that item.

There will be upto 80 items listed all with unique names, not like the ones shown here. I can not edit the HTML directly, only via JavaScript.

I had so far:

 $('div:contains("Unique Title 2")').parent().parent().addClass('foo');

But somehow it kept adding it to all the items, and when I tried to inject the HTML It replaced all content in the page.

$('.foo').find('.item_price_label').html('<div class="new_stuff_here">Yay content here</div>');

Any ideas? Thanks 🙂

  • 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-06-17T08:55:59+00:00Added an answer on June 17, 2026 at 8:55 am

    You can just do this :

       $('.item_title:contains("Unique Title 2")').closest('.product_item').addClass('textFound').find('.item_price_label').html('<div class="new_stuff_here">Yay content here</div>');
    

    Demo : Jsfiddle

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

Sidebar

Related Questions

I have a basic website nav layout that looks like this: <li class=folder parent_folder>
I have a very basic layout done with Twitter Bootstrap: <body> <div class=container> <!--
I have this basic layout of a grid of 20 numbers, (1-20). I want
I have the following basic layout: <div id=sidebar style=float: left; width: 250px; display block;></div>
My basic layout is this: <table> ... </table> <table> ... </table> // There's actually
I've got a basic layout where the body div is set to a specific
I have a basic bootstrap layout with a navbar and a sidebar(span 3) +
This basic app which was given to me as an project should run quite
I'm reading this basic tutorial on canvas elements . The (almost) in the following
I've created this basic 3D Demo using OpenGL/SDL. I handled the keyboard callback so

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.