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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T10:11:46+00:00 2026-06-18T10:11:46+00:00

I have a header on my website, the header has a button that has

  • 0

I have a header on my website, the header has a “button” that has a Icon and also some text.
When you click this “button” it will show or hide an extra menue on the page by toggeling the visibility of a class.

<div id="header_wrapper">
    <div id="header_area">
        <a class="noSelect" href="#">
            <div id="favuorites_header_wrapper" class="header_item">
                <div id="favuorites_header_font" class="noSelect">Open Menue</div>
                <div id="favuorites_header_icon" class="noSelect"></div>
            </div>
        </a>   
    </div>
    <div id="hidden_favuorite_area_wrapper">
        <div id="hidden_favuorite_area">Your personal area</div>
    </div>
</div>
<div id="content_wrapper">foo</div>

Now I want to hide this menue again, when you click outside the header or menue area.

I tried

$(document).click(function(event){
    if(event.target.id =="content_wrapper"){
        // hide
    }
});

But event.target.id returns the ID of the clicket element only, not the parent.
How do I accomplish this?

  • 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-18T10:11:47+00:00Added an answer on June 18, 2026 at 10:11 am

    One approach is to stop propagation of the click event within the element.

    $(document).click(function(event){
      // hide
    });
    
    $("#header_wrapper, #menu_wrapper").click(function(e){
        e.stopPropagation();
    });
    

    This will stop event bubbling beyond these elements. In this way, any click within #header_wrapper or #menu_wrapper (or whatever your menu is called) will not trigger the document’s handler.

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

Sidebar

Related Questions

I have a website that has a fixed menu, header, etc. and loads the
I have a website that has images with urls like this: http://mysite.com/image1.jpg My server
I an writing a website that will have multiple skins. Each skin has its
I have a website that I want to add Javascript to the header part
I have a header and footer that I am testing for a website I
I have a website which has some non standard characters such as ë ,
The Website I am working on has some weird cache issues. When I click
Im trying to get a website to have a button that forces a download
I have some keywords in the header of my website. Every few second I
So I have a website that has greate Search Engine rankings, and like 500+

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.