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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:14:18+00:00 2026-05-26T04:14:18+00:00

I have a help div that becomes visible, I made it so that if

  • 0

I have a help div that becomes visible, I made it so that if a click is outside the div, it closes the help div.

I want the div to remain open if the user click inside the div. For regular Javascript, I use the bubbling up code to match the parent’s id. My partial JS code is

var click = (e && e.target) || (event && event.srcElement);
var match = "divid";

while(click.parentNode){
        if(click==match) {
        return;//do nothing
            }//if

what is the jquery equivalent to this recursive javascript code?

TIA

edited to avoid confusion.

  • 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-26T04:14:19+00:00Added an answer on May 26, 2026 at 4:14 am

    You could return false and it’ll work. Or you could use stopPropagation() which is a utility function built into jQuery:

    jQuery("#divid").click(function(event) {
      event.stopPropagation();
    });
    

    Fiddle here: http://jsfiddle.net/W8MfD/

    The return false method will still bubble up before returning false, as I understand it.

    I do tend to believe that if you anticipate using lots of these kinds of events, you would benefit from using some sort of widget framework. The kind of behaviour you’re creating is commonplace and most frameworks already have it. jQuery UI isn’t bad (though in my opinion it could be better). There are others out there, too.

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

Sidebar

Related Questions

Humbly asking for help with (of course) IE. I have a div that is
I have created some JQuery that on click of specified HTML it then becomes
I have a div that contains an iFrame and I want to ensure that
I have a Help page, help.php that I am loading inside an iframe in
I need help in centering one DIV withing a DIV. I want to have
Please help! I have some form elements in a div on a page: <div
I'm trying to have 'help' tooltips which appear when you click on labels of
Hi I have a simple sidebar inside a div which has height:100% and I
I want to implement page footer. The main idea here is that text inside
I have a problem with my layout. I have a content div that I

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.