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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T03:56:49+00:00 2026-06-17T03:56:49+00:00

I have one large rectangular parent div inside which there are many child divs.

  • 0

I have one large rectangular parent div inside which there are many child divs. I have an on(click) function that runs when the parent div is clicked, but by default it also runs when anything within the parent div is clicked (including the children).

However, I don’t want the on(click) function to run when one specific child of the parent is clicked. How do I make a selector that selects the parent div and everything in it apart from this one child?

Thanks

<div class="box"">

<div class="overlay"><div id="text"></div></div>
<div class="slide">
    <div class="slideleft"></div>
    <div class="slideright">
        <span class="upvote">Upvote</span>
        <span class="counter"></span>
    </div>
</div>

</div>

Now, this is all within the ‘box’ div and you can see a demo of what happens here. If you click the upvote button after having already clicked on a box, then the thing slides back down which I don’t want it to. This is the code I’m trying to use right now for this but it’s not working:

$("body").on("click", ".box", function(e){
        if(e.target.class == 'upvote') {
            return false;
        } else {
                $(this).children('.slide').slideToggle(150);
                $(this).children('overlay').css('background-color', 'rgba(0,0,0,0)');
            }
});
  • 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-17T03:56:51+00:00Added an answer on June 17, 2026 at 3:56 am

    Working Fiddle

    $("body").on("click", ".box", function (e) {
    if (e.target.className != 'upvote') {
      $(this).children('.slide').slideToggle(150);
      $(this).children('.overlay').css('background-color', 'rgba(0,0,0,0)');
    }
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have one large div with one smaller div inside it. The smaller div
I have many string pairs and one large string (which is the content of
I have multiple connected ul lists. There is one large UL list that I've
I have a large-ish project that contains one class that reads from a file
I have a large program that is working other then one .h file that
i have a large mysql database table in which one column contains values ranging
I have one voter table which contain large amount of data. Like Voter_id name
I have a layout which has one large EditText view at the top +
I have one large view with a toolbar that allows a user to select
I have one large project with components in multiple languages that each depend on

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.