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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T05:40:28+00:00 2026-06-08T05:40:28+00:00

HTML <body> <span>test</span> <span>test</span> <span>test</span> <span id=show>aaaaaa</span> </body> JS $(‘body’).hide(); $(‘#show’).show(); Why doesn’t this

  • 0

HTML

<body>
    <span>test</span>
    <span>test</span>
    <span>test</span>
    <span id="show">aaaaaa</span>
</body>

JS

$('body').hide();

$('#show').show();

Why doesn’t this work? How can I make it work?

Now all is hidden, but if I use $('#show').show(); it should make #show visible. Is this possible? If yes, how?

I want hide all elements without #show, but I can’t modify the HTML.

  • 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-08T05:40:31+00:00Added an answer on June 8, 2026 at 5:40 am

    To hide all elements without id="show", you can use the not function:

    $('body').find('*').not('#show').hide();
    

    or the :not psuedoselector:

    $('body').find(':not("#show")').hide();
    

    Edit: to also show all children of #show, add that to the not selector:

    $('body').find('*').not('#show, #show > *').hide();​
    

    http://jsfiddle.net/ZD7gm/3/

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

Sidebar

Related Questions

I'm probably misunderstanding JSON, but why this code doesn't work? HTML <html> <head> <title>Test</title>
The code is as below: <html> <head> <title>test</title> </head> <body> <div><span>shanghai</span><span class=margin> </span><span>male</span></div> </body>
I have a string: private str:String = ' <!DOCTYPE html> <html> <body> <div>TEST</div> <span
Given the following XML structure <html> <body> <div> <span>Test: Text2</span> </div> <div> <span>Test: Text3</span>
This is the HTML I have: p_tags = '''<p class=foo-body> <font class=test-proof>Full name</font> Foobar<br
test.html <html> <body> <span> hello Joe</span> <span> hello Bob</span> <span> hello Gundam</span> <span> hello
Why doesnt this work? $('#websitedesign').load('test.html', function() { alert('Load was performed.'); }); Jquery version using:
Consider the following code: $(document).ready(function() { $(body).append(<div class='outer'><span class='inner'>Click me</span></div>); $(html).click(function(event) { var targetClass
<html> <head></head> <body> <span class=mtb-price> <label Class=mtb-ofr><b class=lb1></b>AAAAA</label></span> <script> var sku = document.getElementsByClassName(mtb-ofr).childNodes[1].nodeValue; alert(sku);
how can i convert xpath like /html/body/div[3]/ul/li[1]/a[5] html > body > div[3] > ul

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.