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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T10:38:43+00:00 2026-05-20T10:38:43+00:00

Today while I was writing some code for two methods that shows and hides

  • 0

Today while I was writing some code for two methods that shows and hides a menu, I made a small test to see the most efficient way to check the visibility of the menu.

The results varied from a browser to another, FF 4.0b12 is faster using $.data, but Chrome (webkit) and Opera is faster when using $.is(':visible').

I couldn’t test on IE9 , because the browser kept locking on me!
Here is the test case: http://jsperf.com/data-or-display/3

So, what’s the most efficient way to check visibility WITH 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-05-20T10:38:44+00:00Added an answer on May 20, 2026 at 10:38 am

    $('whatever').is(':visible') reads the best. I think that is what matters. Unless you need to check hundreds of elements a second, I would not waste my time.

    "We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil"

    Donald Knuth

    Source (PDF)

    If you must get the best performance, ditch jQuery and use native JavaScript.

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

Sidebar

Related Questions

Today while writing some Visual C++ code I have come across something which has
I got an error today while trying to do some formatting to existing code.
Today I was writing some C code to sort an array of structs using
Today at work we came across the following code (some of you might recognize
Today I discovered that my fresh installation of Apache HTTP Server is able to
Today I had a coworker suggest I refactor my code to use a label
I have some data that is both read and updated by multiple threads. Both
I am writing in request of some suggestions for some well-designed open source Java
I am still writing on a python interface for my c code with ctypes.
I've started playing with Lucene.NET today and I wrote a simple test method to

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.