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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T21:05:59+00:00 2026-06-03T21:05:59+00:00

I have html structure like below: <div id=banner-menu-holder> <div> <div class=avalible> <div class=items-holder> <div>

  • 0

I have html structure like below:

<div id="banner-menu-holder">
    <div>
        <div class="avalible">
            <div class="items-holder">
                <div>
                    <div class="img-holder">
                        <div>
                            <input id="set_banner_29" type="checkbox" onclick="mod.setBanner(29);">
                            ...
                        </div>
                    </div>
                </div>
                ...
            </div>
        </div>
        <div class="ready">
            <div class="items-holder">
                <div>
                    <div class="img-holder">
                        <div>
                            <input id="rem_banner_1_8_32" class="remove_banner" type="checkbox" checked="checked">
                            ...
                        </div>
                    </div>
                </div>
                ...
            </div>
        </div>
    </div>
</div>

and js code:

$(document).click(function(ev) {
    if ($(ev.target).parents().index($('#banner-menu-holder')) == -1) {
        $('#banner-menu-holder').css('display', 'none');
    }        
})

When I clicked checkbox into first div (class avalible) then function has been successfull executed – this chekbox is child of main div (#banner-menu-holder).

When I clicked second div’s checkboxes and the function had not worked. jQuery didn’t detected that these checkboxes are children of main div.

Is that problem into jQuery or otherwise?

  • 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-03T21:06:01+00:00Added an answer on June 3, 2026 at 9:06 pm

    Seems like you’re doing event delegation, but in a very clunky way.

    jQuery makes this easier with .on().

    $(document).on('click', '#banner-menu-holder', function(ev) {
        $('#banner-menu-holder').css('display', 'none');
    });
    $(document).on('click', ':not(#banner-menu-holder)', function(ev) {
        $('#banner-menu-holder').css('display', 'none');
    });
    

    If you’re using jQuery 1.4-1.6.x, you’d use .delegate() instead.

    $(document).delegate('#banner-menu-holder', 'click', function(ev) {
        $('#banner-menu-holder').css('display', 'none');
    });
    
    $(document).delegate(':not(#banner-menu-holder)', 'click', function(ev) {
        // do something else
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Assuming I have this HTML structure: <ul class='menu'> <li> <div></div> <div> <div></div> <div> <a
I have a HTML structure like follows <div id=answer-1> <a class=edit></a> </div> <div id=answer-2>
I have a html structure like : <div onmouseover=enable_dropdown(1); onmouseout=disable_dropdown(1);> My Groups <a href=#>(view
I have this html structure <div class=top_menu> <ul> <li class=left><a href= class=family-filter>asdas</a></li> <li class=welcome>Welcome
I have a html structure like this.. <div id=divid> <ul id=ulid> <li style=margin-left: 8px>
I have a HTML structure like this: <ul id=carousel class=jcarousel-skin-photos> <li><a href=images/content/featuredPhoto.jpg><img src=images/content/featuredPhoto.jpg alt=Lorem
I have a html structure like this : <div id=nav_holder style=position:absolute;border-radius:400px;width:0px;height:0px;background-color:#460203;z-index:350px;> <div id=inner_wrap> </div>
I have one html structure , somethinh like <div> <div id=mydiv> <h3> This is
We have the HTML structure used with jquery-form-wizard: <form> <div class='page1'>...</div> <div class='page2'>...</div> ...
I have this HTML structure and want to convert it to an accordion. <div

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.