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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T00:57:38+00:00 2026-05-30T00:57:38+00:00

I need check every .archive_blocks for containing .archive_blocks_fa_active. If is it true, apply css

  • 0

I need check every .archive_blocks for containing .archive_blocks_fa_active.
If is it true, apply css to .archive_blocks_sa.

<div class="archive_blocks">
    <a href="#" class="archive_blocks_fa_active">
        <img width="142" height="142" src="#">
    </a>
    <div class="archive_blocks_name">
        <a href="#" class="archive_blocks_sa">Ilustrations</a>
    </div>
</div>

JQUERY:

 $('.archive_blocks').each(function(){

    if ( $("a.archive_blocks_fa_active").parents(this).length == 1 ) { 
        alert('OK'); 
    } else {        
        alert('NO');    
    }
});
  • 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-30T00:57:39+00:00Added an answer on May 30, 2026 at 12:57 am

    Assuming I’ve understood your question correctly, can’t you just do this and not bother with the each:

    $(".archive_blocks a.archive_blocks_fa_active")
        .closest(".archive_blocks")
        .find(".archive_blocks_sa")
        .addClass("whatever");
    

    This uses a descendant selector which matches any a.archive_blocks_fa_active element that is a descendant of an .archive_blocks element. It then finds the related .archive_blocks_sa (there would be other ways of doing that, perhaps using parent and next if you prefer) and then adds the class.

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

Sidebar

Related Questions

im making a investigation and i need to check every 15 min for about
I need to check every five minutes if 4 servers are online from one
How do I check if all checkboxes with class=abc are selected? I need to
what I basically need is to check every element of a list and if
I need Ajax script that will check every 5 seconds, the contents of file.php
I have 100Mb text file and I need to check every line for special
I need to write an interceptor/filter in my spring-jersey application, which will check every
I need to check every script tag's src value and if there is a
i want something like this the user enter a website link i need check
I need to check programmatically (in .NET) whether a given user (domain account) is

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.