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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T14:48:08+00:00 2026-06-01T14:48:08+00:00

I show us the code: (function (){ var element = document.getElementById(‘bar’), hideElement = document.getElementById(‘foo’),

  • 0

I show us the code:

(function (){
  var element = document.getElementById('bar'), hideElement = document.getElementById('foo'),
  var html = document.getElementsByTagName('html')[0];
  tool.onclick = function() {
    hideElement.style.display = 'block';
    html.onclick = function() {
      hideElement.style.display = 'none';
    }
  }
})();

This piece of code work’s fine, but, after clicking html, I can not reopen the hidden element.

I want to click the html element and give display:none to hideElement, then to click the element id=”bar”, give to the hidden element display:block, but instead of click the element foo, click the html element. What I can do?

Oh, i need help WITHOUT JQUERY, thanks 🙂

EDIT: something like that : click on body except some other tag not working , but without JQuery,

  • 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-01T14:48:09+00:00Added an answer on June 1, 2026 at 2:48 pm

    I’m not sure it’s going to answer your question, but here it is: how to handle an event on the body except one element:

    document.documentElement.onclick = function(e) {
        var evt = e || window.event, // IE...
            target = evt.target || evt.srcElement // IE again...
        // There, "target" is the element clicked. See where I'm going?
        if (target.id !== "foo") {
            // Do w/e you want if the page was clicked, except for "foo"
        }
    }
    

    This is the concept of “event bubbling”. You can listen to one element and all its children at once, and get the target as specified in the code up there.

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

Sidebar

Related Questions

I have the following code: function show(){ var a=document.getElementById('somediv').style.display; a=block; } The above code
I am testing this simple code below and it works... $(document).ready( function() { $('.show-modal').click(
I'm using the following jQuery code to hide and show some HTML element in
The code like this: $(.hide).click(function(){ $(.online-contact).animate({width: 'toggle',height: '100%'}, fast); $(this).hide(); $(.show-class).show(); }) I want
So, I have this simple code $('#info_name'+index).show(slide, {direction: right}, 1000, function(){ $('#info_info'+index).show('slide',{direction: up}, 1000);
I guess the subject sounds pretty stupid, so I'll show some code: def foo(**kwargs):
Here is my code: function testimage() { var image; image = new Image(); with
This is my alert function to show the alert message: function alertPopup() { var
Following is the javascript code var text; var name; window.onload = init; function init()
We use scrollto. Code:js $(document).ready(function() { $(a.anchorLink).anchorAnimate() }); jQuery.fn.anchorAnimate = function(settings) { settings =

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.