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

  • Home
  • SEARCH
  • 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 6943313
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T13:08:21+00:00 2026-05-27T13:08:21+00:00

I have done the following code structure and doing addClass item_box_popup and removeClass item_box

  • 0

I have done the following code structure and doing addClass item_box_popup and removeClass item_box on click of item_box div.

<div class="item_box"> <!--This is the small div which when clicked changes to the item_box_popup div-->
  <div class="name">...</div>
  <div class="detail">...</div>
</div>

<div class="item_box_popup"> <!--This div expands to show the detail and the children in it has a click event-->
  <div class="name">...</div>
  <div class="detail">...</div>
</div>

The item_box div has a click event in it and not the children. The working is to change the div to item_box_pop div by addClass and removeClass when clicked.

The item_box_popup does not have a click event but the children has the click event defined. We have used delegate to define the click event for .item_box_popup .name etc.

The problem is when we click the item_box div the click event defined for .item_box_popup .name is also getting triggered. This may be due to the change class defined on click for .item_box.

I don’t want the click event to trigger on the children when .item_box is clicked. I have tried undelegate to stop triggering of click on item_box children and just do the change class defined in the click for it but this is not working.

The click event for .item_box

$('.slide > div').bind('click',function(e) {
    if(!$(this).hasClass('item_box_popup')){
        var index=$('.slide > div').index(this);
            $(this).removeClass('item_box');
            $(this).addClass('item_box_popup');     
        Nomad.config.firstVisibleItem=index;<!--This is to set the position for .item_box_popup-->              
    }           
});

The click event for .item_box_popup

$("body").delegate('.item_box_popup .name, .item_box_popup .detail','click', function(e){
  //working code here for this
});

e.stopPropagation(); disables the default click handler of .item_box

  • 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-27T13:08:22+00:00Added an answer on May 27, 2026 at 1:08 pm

    Try adding event.preventDefault(); after the call that you do want to happen, it stops the default action from happening e.g. the default action of an a element.

    I can’t say exactly where to try the call or whether it will solve your problem without seeing your js code though. The html isn’t where your problem is, its the js code, so if this (or the other answer that posted while I was typing this!) doesn’t work can you edit your post to include your js, please?

    Update:

    I’ve copied your code into JSFiddle and added an e.stopPropagation() call to the item_box click handler, and it works as I expected: http://jsfiddle.net/chkaQ/2/

    When you click on an item_box child div, it changes it to an item_box_popup and doesn’t execute the item_box_popup child click event… have I got it wrong, or is that not what you want it to do?

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

Sidebar

Related Questions

I have a form of following structure ROR code form_tag class='remote_form' remote=>true { some
I have done the following code in JavaScript to put focus on the particular
I have just started using jQuery and although following code gets the job done,
I have the following code: public static class ScraperMasterUriDetails { public static Dictionary<Guid, string>
I have a jQuery slideshow code that works fine with the following HTML structure:
i have done the following code in order to fill a tuple with user
I have done the following form <% form_for @anexo, :url => {:action => create},
How can I self-sign an iPhone application using Xcode? I have done the following:
I have done simple java app for blackberry, while building am getting following error.
I have done a bit of testing on this myself (During the server side

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.