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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T03:32:04+00:00 2026-05-20T03:32:04+00:00

I have the following layout: <div id=content> <div id=img><img src=></div> <div id=main>Some content</div> <div

  • 0

I have the following layout:

<div id="content">
  <div id="img"><img src=""></div>
  <div id="main">Some content</div>
  <div id="btn" class="hidden"><button>Submit</div>
  <div class="hidden">Some other stuff</div>
</div>

I have jQuery click event tied to the content div that expands it and makes the hidden divs (the button and more content) visible. I also have an event tied to the button that activates a modal on click.

The expand/collapse of the div works without a problem using hide/show methods. The problem is after clicking on the button, the div collapses even though the modal is activated.

So after clicking on the Submit button, the modal pops up but in the background the main div is collapsed. I am trying to keep the main div open if the Submit button is pushed.

I tried setting the z-index fields on the button and the containing div to a value higher than what’s on content div; this did not help.

How could I keep the functionality of clicking anywhere in the collapsed div (where the button and extra content are not visible) expands that div and clicking on the button in the expanded div activate the modal dialog without collapsing the main div?

Thank you

  • 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-20T03:32:05+00:00Added an answer on May 20, 2026 at 3:32 am

    You have to prevent the event from bubbling up. When you click the button, the click event bubbles up the DOM tree and triggers other event handlers.

    Have a look at event.stopPropagation():

    $('button').click(function(event) {
        event.stopPropagation()
        // modal stuff
    });
    

    You can also ignore all clicks that don’t originate at the #content div:

    $('#content').click(function(event) {
        if(event.target == this) {
           // hide/colapse
        }
    });
    

    This might be better if you want to click “anywhere” inside the div without hiding it.

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

Sidebar

Related Questions

i have following HTML structure: <div class=container> <div class=sidebar></div> <div class=content></div> <div class=subscript></div> </div>
Say I have the following DIVs: <div id=top>Page header</div> <div id=main>Main content</div> <div id=sidebar>Sidebar
I have the following simple layout: div.main { width: 300px; border: 2px solid #98999E;
I have the following in my application layout page <body> <div class=container showgrid> <%=
I have some recursive HTML in the following tree structure: div.item div.content input div.container
I have the following layout : And following code : public class MailSenderActivity extends
I have the following 2 column div layout. The left column needs to have
I have following code snipped in _Layout.cshtml <div id=sub-navig-container> @RenderSection(subNavig) </div> <div id=text-content> @RenderBody()
I have the following layout with a sidebar that is only present on some
I am beginner.I have the following div structure in zend layout.phtml <div id='outer'>//start outer

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.