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 9193043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T21:04:05+00:00 2026-06-17T21:04:05+00:00

Given the div structure below, I’m trying to get the text in each div.class

  • 0

Given the div structure below, I’m trying to get the text in each div.class content.

I’ve been using next() which only works for the first 2 elements and is a bit unwieldy. Is there a way I can get the content values using selectors (would be more elegant)?

Because there are many holder divs on the page I need to use the selectors relative to each holder div.

Thanks,

$(".holder").each(function() {
var image = $(this).next().text();  //get value   
var title = $(this).next().next().text(); //gets value
} 

<div class="holder">
    <div class="field-image">
        <div class="content">content</div>  
    </div>
    <div class="field-title">
        <div class="content">content</div>  
    </div>
    <div class="field-location">
         <div class="content">content</div>  
    </div> 
   <div class="field-sector">
         <div class="content">content</div> 
   </div>
</div>
  • 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-17T21:04:06+00:00Added an answer on June 17, 2026 at 9:04 pm

    It seems you just need to get the text content of each child (or of the .content element of each child):

    $('.holder').each(function() {
        var texts = {};
        $(this).children().each(function() {
            // Assuming each child has only one class
            texts[this.className.replace(/^field-/, '')] = 
                $(this).find('.content').text();
        });
    
        // now do something with e.g. texts.image, texts.title, etc.
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Two jQuery questions: 1) Given this HTML structure <div id=tipper class=tiplink><a href='test.html' >Link Text</a>
Given a structure like: <div class=Stargate id=MGM> <div class=SG1> </div> <div id=Atlantis> </div> </div>
Given the following HTML structure: <div id=wrapper> <div id=top> <a href=http://example.com class=link>click here</a> </div>
My HTML structure is like this : <div class=controls> <input id=car class=span3 type=text placeholder=B.E
I have a DOM structure below: <div class='box'> <section id=profile> <h1>testuser</h1> <div id=following> <a
i'm having this html structure: <div class=container> <div class=content> Content goes here </div> </div>
Given the following HTML structure: <div class=wrapper> <div class=top> <a href=http://example.com class=link>click here</a> </div>
I am stuck trying to get my model populated given the domain table structure.
I have the following given html structure <li class=g> <div class=vsc> <div class=alpha></div> <div
Given a DIV with this general structure (class=post, from an extracted message board post)

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.