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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T11:31:22+00:00 2026-05-22T11:31:22+00:00

I’ve got the next HTML code: <div id=main-container> <article id=doyou>…</article> <article id=theydid>…</article> <article id=nieuws>…</article>

  • 0

I’ve got the next HTML code:

<div id="main-container">
  <article id="doyou">...</article>
  <article id="theydid">...</article>
  <article id="nieuws">...</article>
  ...
</div>

I’m trying to hide the articles when clicked on the div outside the articles, but not when the articles itself are clicked. Currently I got the following code, but it ain’t working:

code:

$("#main-container").click(function(){
        $('article#doyou').not(this).hide();
        $('article#theydid').not(this).hide();
        $('article#nieuws').not(this).hide();
        $('article#stage').not(this).hide();
        $('article#info').not(this).hide();
        $('article#contact').not(this).hide();
        $('article#letop').not(this).hide();
    });
  • 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-22T11:31:22+00:00Added an answer on May 22, 2026 at 11:31 am

    First of all I’d give each article a common class:

    <div id="main-container">
        <article id="doyou" class="article">...</article>
        <article id="theydid" class="article">...</article>
        <article id="nieuws" class="article">...</article>
        ... other articles ...
    </div>
    

    Then in jQuery you can use that class to hide all except the clicked element:

    $(function() {
        $(".article").click(function() {
            hideArticles();
            $(this).show();
        });
    
        $("#main-container").click(function(e) {
            if (e.target.id == "main-container")
                hideArticles();
        });
    });
    
    function hideArticles() {
        $(".article").hide();
    }
    

    As I mentioned in my comment though, there is no mechanism for displaying all the articles again. Once an article has been clicked, all others will not be recoverable.

    You may want to add a ‘show articles’ button:

    $("#show-articles").click(function() {
        $(".article").show();
    });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

link Im having trouble converting the html entites into html characters, (&# 8217;) i
Basically, what I'm trying to create is a page of div tags, each has
i got an object with contents of html markup in it, for example: string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have this code to decode numeric html entities to the UTF8 equivalent character.
I am trying to understand how to use SyndicationItem to display feed which is
I've got a string that has curly quotes in it. I'd like to replace
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I have this code: - (void)parser:(NSXMLParser *)parser foundCDATA:(NSData *)CDATABlock { NSString *someString = [[NSString

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.