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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T18:52:44+00:00 2026-05-26T18:52:44+00:00

On BBC articles, such as this one , there is a DOM element with

  • 0

On BBC articles, such as this one, there is a DOM element with class story-body, deep in the DOM chain.

I want to hide all DOM element “outside” of this (unique) DOM element. The problem is that I can’t just do

$('*').hide();
$('.story-body');

because I need to make sure to keep the parents, grand-parents, etc. of story-body. I also can’t do

$('*').hide();

var current = $('.story-body').show();
while(current = current.parent()) {
   current.show();
}

because that would simply show everything.

Any suggestions?

  • 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-26T18:52:45+00:00Added an answer on May 26, 2026 at 6:52 pm

    You could hide everything, then show .story-body, its chain of ancestors, and all of its descendants:

    $("body *").hide();               // Hide all
    var sb = $(".story-body").show(); // Find and show story-body
    sb.parents().show();              // ...and its parents
    sb.find("*").show();              // ...and its contents
    

    Or as a two-liner if you like to super-compact things:

    $("body *").hide();
    $(".story-body").show().parents().show().end().find("*").show();
    

    But I wouldn’t count on the effect of hiding all of those other elements. Although when I tried it on that story, it worked fine.

    Here’s a bookmarklet for it, copy the javascript: line below and paste it in as the target of a bookmark, then navigate to a BBC News page and click the bookmark:

    javascript:(function(){(function(){var d=document,s=d.createElement("script"),st=new Date();s.src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js";d.body.appendChild(s);after();function after(){var $,sb;if(typeof jQuery!=="function"){if(new Date()-st<5000){setTimeout(after,100);}return;}$=jQuery.noConflict();$("body *").hide();sb=$(".story-body").show();sb.parents().show();sb.find("*").show();}})();})();

    Source:

    (function() {
        // Load jQuery
        var d = document,
            s = document.createElement("script"),
            st = new Date();
        s.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js";
        d.body.appendChild(s);
    
        // Wait for it to load
        after();
        function after() {
            var $, sb;
            if (typeof jQuery !== "function") {
                // Not loaded yet
                if (new Date() - st < 5000) { // Give up after 5 seconds
                    // Try again in 100ms
                    setTimeout(after, 100);
                }
                return;
            }
    
            // Minimize impact
            $ = jQuery.noConflict();
    
            // Do the work
            $("body *").hide();
            sb = $(".story-body").show();
            sb.parents().show();
            sb.find("*").show();
        }
    })();
    

    Seems to work just fine on the four or five stories I tried.

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

Sidebar

Related Questions

So, the BBC just released the story that ICANN is going to approve non-latin
I want to grab a user's uploads (ie: BBC) and limit the output to
a[b].innerHTML=a[b].innerHTML.replace(RegExp('['+bbc[c][0]+']','ig'),bbc[c][1]) This is basically what I'm working with. It's wrapped in two loops so
I've just stumbled across this fascinating article on the BBC website regarding producing music
Some mobile web sites such as the BBC mobile website stop you zooming in
I want to create a site that does exactly the same as the BBC
Alright, this one (3a; sample problem with provided answer) has got me scratching my
I was just looking Christmas recipes and I noticed this URL. http://www.bbc.co.uk/food/recipes/search?dishes[]=mulled_wine Can anyone
I was just looking Christmas recipes and I noticed this URL. http://www.bbc.co.uk/food/recipes/search?dishes[]=mulled_wine Can anyone
OK, I don't understand this at all. This is the BBC's RSS feed (

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.