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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T14:15:21+00:00 2026-05-23T14:15:21+00:00

Why is a tr element that hasn’t been added to the DOM considered visible

  • 0

Why is a tr element that hasn’t been added to the DOM considered visible in jQuery, but a div is not?

$('<tr></tr>').is(':visible')     // returns true
$('<div></div>').is(':visible')   // returns false

I’m using jQuery 1.4.2. I tested this in Firefox 5, IE 9, Chrome 12, and Safari 5, and Opera 11.5.

Resolution

I’ve written a workaround to use in my application until I can upgrade to a more recent version of jQuery:

$('<tr></tr>').is('body *:visible')     // returns false
$('<div></div>').is('body *:visible')   // returns false

Thanks for all the help everyone!

  • 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-23T14:15:22+00:00Added an answer on May 23, 2026 at 2:15 pm

    visible doesn’t mean that you can physically see it. It will still be true even when your eyes are closed, for example.

    The node itself has no concept that the browser only renders one DOM tree.

    It has no attributes set whereby an HTML browser would treat it as “invisible”, therefore it is “visible”… even if it’s not part of the one node tree that the browser’s actually rendering.

    You might also ask how $('<b>Bold text</b>') can possibly be bold, or have any graphical formatting, when it cannot be seen.

    From the documentation:

    Elements can be considered hidden for
    several reasons:

    • They have a CSS display value of none.
    • They are form elements with type=”hidden”.
    • Their width and height are explicitly set to 0.
    • An ancestor element is hidden, so the element is not shown on the page.

    Clearly none of these are true here.

    I cannot explain why Dunhamzzz is able to produce a different result, though! It may be related somehow to the iframe in which the fiddle runs.


    Update

    OK, jsfiddle.net has nothing to do with it.

    However, I can reproduce this with 1.4.2.

    So one or both of them is wrong. Given the inconsistent behaviour of tr vs div, I’d suggest that 1.4.2 is incorrect (there were a number of hidden-item-related changes in 1.4.4) and that the documentation is misleading.

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

Sidebar

Related Questions

I have a form element that I want to address via javascript, but it
I have a div element that has an id and this div contains a
I have an element that can have multiple types (not my design). The element
I want to show first element that is hidden by jquery. my html code
hoping this hasn't been asked before, but I have the following XML: <Company id=1000
(Apologies if this has been asked before - I can't believe it hasn't, but
I have backbone view that binds an action to an element in the DOM.
I have a form element that contains multiple lines of inputs. Think of each
I have an element that is similar to a tag (because it has word-wrap:
I have a button element that I've created like so: $submit = new Zend_Form_Element_Button('submit');

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.