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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T12:08:10+00:00 2026-06-14T12:08:10+00:00

stuck on a point with jquery. I have to loop through several div’s with

  • 0

stuck on a point with jquery.
I have to loop through several div’s with the same structure and need the text inside the <h1> tag plus every <li> with the class ‘.checked’

<div id="a21315" class="content gradient">
<div class='header gradient'>
    <div class='headimg'></div>
    <h1>Input Shaft Size</h1>
    <div class="minus_sprite "></div>
    <ul class="de-radio ">
        <li id="a22134340"><span class='checked'>0.4375" X 0.88"</li>
        <li id="a22151870"><span class=''>0.500" X 1.13"</li>
        <li id="a22168545"><span class=''>0.625" X 1.50"</li>
        <li id="a22172070"><span class=''>0.625" X 1.57"</li>
        <li id="a22184915"><span class=''>0.750" X 1.57"</li>
        <li id="a22946970"><span class=''>0.875" X 1.97"</li>
    </ul>
</div>

I expect a result like this and wish to copy this in another div (#overview).

Text from Headline 1
-List Element with checked Class 1
-List Element with checked Class 2
-List Element with checked Class 3

Text from Headline 2
-List Element with checked Class 1
-List Element with checked Class 2
-List Element with checked Class 3
etc.

with this $('.content.gradient:not(.hidden) h1').text(); I receive every Headline()
and with this line:
$('.content.gradient:not(.hidden) ul li.checked span').not('.hidden').text();

I received all selected <li> with the .checked class. But how can I loop throught all this and can get it?

I hope I described my problem comprehensible.

  • 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-14T12:08:10+00:00Added an answer on June 14, 2026 at 12:08 pm

    But how can I loop throught all this

    You could do:

    var $overview = $('#overview');
    $('.content.gradient:not(.hidden)').find('.header.gradient').each(function(){
        var headingText = $(this).find('h1').text();
        var $checkedItems = $(this).find('span.checked').not('.hidden');
        var checkedItemsText = '';
        $checkedItems.each(function(){
            checkedItemsText += $(this).text() + '<br/>';
        });
        $overview.append(headingText + '<br/>' + checkedItemsText );
    });
    

    EDIT:

    Sorry, made couple of typos – the above is now correct. Here’s a working demo.

    EDIT 2:

    For better performance it’s good to cache the #overview – updated the code above.

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

Sidebar

Related Questions

I'm new to jQuery and I have got stuck on an each loop. I'm
I am stuck with the rotation I have set the movieclip's registration point to
I am creating a little gallery using jQuery and stuck on a small point
All, I am really stuck/ confused at this point. I have an array with
i'm stuck at a point where i am using a wildcard parameter with the
I'm learning Objective-C but I'm stuck at this point where it comes to multiple
I am stuck at a Local to Global Point issue in Objective C ViewController
I'm stuck at this method and I don't know why! Can anyone point me
I'm using the excellent Jquery-Filedrop [weixiyen] used by tutorialzine and I'm stuck on a
Basically, I have HTML5 markup with two empty divs. I want to use JQuery

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.