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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T23:11:48+00:00 2026-05-22T23:11:48+00:00

I have been attempting to capture the event when a user clicks on a

  • 0

I have been attempting to capture the event when a user clicks on a section of my menu that doesn’t contain any other type of contents / class.

The menu itself is separated into two portions, both of which are floated (one on the right and another on the left) and I am just trying to grab when the click occurs inside the parent div (the menu) and outside of the floated divs.

Markup:

<div id='test'>
    <div class='t1'>
    </div> 
    <div class='t2'>
    </div>
</div>

CSS

#test
{
     background-color: red;
     height: 30px;
     width: 50%;
     position: relative;

}
.t1
{
     float: left;
     width: 45%;
     height: 30px;
     background-color: blue; 
     margin: 0;
     padding: 0;
}

.t2
{
     float: right;
     width: 10%;
     height: 30px;
     background-color: blue; 
     margin: 0;
     padding: 0;
}

Example:

jsFiddle Example!

I was mainly wondering if this was possible just using selectors through jQuery, as opposed to another method of examining what was clicked and determining if the correct area was clicked. (Both of these methods are acceptable though.)

  • 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-22T23:11:49+00:00Added an answer on May 22, 2026 at 11:11 pm

    Compare this to e.target. If they are the same, the element where the event is handled will be the same as the one where it originated.

    $('#test').click(function(e)
    {
        if (this === e.target) {
            alert('#test itself clicked');
        } else {
            alert('some child element was clicked');
        }
    });
    

    jsFiddle.

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

Sidebar

Related Questions

I have been attempting to handle the KeyDown event of a UserControl (page) in
I have been attempting to have a object that I can use across multiple
I have been attempting to write some routines to read RSS and ATOM feeds
Have been looking at the MVC storefront and see that IQueryable is returned from
I have been attempting to dive into RSpec 2 but its auto generated controller
I have been attempting to write a reusable generic method for lookups on a
I have created four tabs with listview in each. I have been attempting to
I have been attempting to perform multiple (different) string replacement with recursion and I
I have been attempting to develop a PHP API for a website. I have
I have been attempting to use OpenGL with C++ lately and I have come

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.