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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:21:22+00:00 2026-06-17T04:21:22+00:00

I have a big outer div with many identical circles (which is a smaller

  • 0

I have a big outer div with many identical circles (which is a smaller div with border-radius 100%) in it.

I am using jquery to fade out these circles s when a user clicks on them, however I want to add additional event when the only remaining circle is clicked.

:last-child or :nth-child() are not going to help, as I don’t mind which circle is clicked until only one of them remains.


Again, the elements are FADED OUT so they are still siblings of the visible elements. So what I need is to select the “last visible” element.

<div>

<div class="circle"></div>

<div class="circle"></div>

<div class="circle"></div>

<div class="circle"></div>

<div class="circle"></div>

<div class="circle"></div>

<div class="circle"></div>

<div class="circle"></div>

</div>

$(document).ready(function(){
    $(".circle").click(function(){
        $(this).fadeOut("slow");
    });
    $("XXX").click(function(){
        alert("I was the last of Mohicans");
    });
});
  • 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-17T04:21:23+00:00Added an answer on June 17, 2026 at 4:21 am

    Why not

    .circle:first-child:last-child {
    

    ?

    EDIT for edited question :

    If you want to test when clicking if the element is the only one visible, you can do this :

    $(document).ready(function(){
        $(".circle").click(function(){
            $(this).fadeOut("slow");
            if ($('.circle:visible').length>1) return; // returns if not the last one
            alert("I was the last of Mohicans");
        });
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have big web application using JQuery UI Tabs. In central JS file I
I have big URL list, which I have to download in parallel and check
I have a big div with some links inside, I'd like to have the
I have one big container (div) and one header div inside of it. It
i have big decision tree with many Yes/No questions. i need implement some code
I have big problems using the InternetGetLastResponseInfo function because of all the weird file
i have big table with many html items such as select, textbox, radio-button, checkbox.
I have a div to show recently viewed items on a page which I
I have one big LinearLayout(vertical)(outer table) and three small linear layouts(horizontal)(one for each row).
I have two tables tableA and tableB, which have the same structure: rowid: big

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.