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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T18:12:40+00:00 2026-05-13T18:12:40+00:00

Edited: I mean grouping as giving the same REL attibute to all IMG s

  • 0

Edited: I mean grouping as giving the same REL attibute to all IMGs in the same post, but each post has different REL as the example at the end of this question.

So, I need to do the following:

<div id="Blog1" class="widget Blog">
<div class="blog-posts hfeed">
<div class="post hentry uncustomized-post-template">
<a name="8829400899632947948"/>
<div class="post-body entry-content">
<div id="8829400899632947948">
<div class="separator">

<a imageanchor="1" href="/images/outta.png">
<img src="/images/outta.png"/></a></div></div>

<div style="clear: both;"/>
</div>
<div class="post-footer">
</div></div></div></div>

I’m using jQuery and Colorbox. The first two DIVs are posts containers. I need to group the IMGs in each <div class="post hentry uncustomized-post-template"> using the REL attribute, like:

1 – Post

1.1 – IMG – REL=”group0″

1.2 – IMG – REL=”group0″

1.3 – IMG – REL=”group0″

1.4 – IMG – REL=”group0″

2 – Post

2.1 – IMG – REL=”group1″

3 – Post

3.1 – IMG – REL=”group2″

3.2 – IMG – REL=”group2″

I’ve tryied HAS, PARENT > CHILDREN and CHILDREN() from jQuery and REL: from Colorbox, but it seems I’m lacking somewhere in logic.

Could someone help me?

  • 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-13T18:12:41+00:00Added an answer on May 13, 2026 at 6:12 pm

    is this what you mean?

    // 'walk' through every element that has class 'post'
    // passing the index of each element to variable i
    $('.post').each(function(i) {
        // on `this` element, find all children img
        // to which add attribute 'rel' with a value of
        // 'group' concatenated with the parent's index (i)
        $(this).find('img').attr('rel', 'group' + i);
        });
    

    edit: add some comments, hope this help those new with jquery

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

Sidebar

Related Questions

Edited at the request of commenters. I hope this is compliant. First post! Trying
EDITED I'm using Twitter Bootstrap and need to move navbar right( not float:right, but
Edited: SOLUTION FOUND. This is strange and not the best solution, but I just
I would think the following piece of code should work, but it doesn't (Edited:
In Scala, what does trait A <: B mean? Is it just the same
Edited: Sorry, I mistyped 'name' when I mean 'ref' and I've included the complete
Edited version of the original How is declaring div#test different to declaring it as
EDITED BELOW FOR UPDATES!!! Thank you for the help, please by all means point
By local I mean both run in the same subnet, in most cases the
Edited: I want to get the actual with of the document with JS. I

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.