---
title: "How do I check if an element is hidden in jQuery?"  
description: "How do I check if an element is hidden in jQuery?"  
author: "Revati S Misra"  
published: 2023-04-27  
updated: 2023-06-11  
canonical: https://www.mindstick.com/forum/158054/how-do-i-check-if-an-element-is-hidden-in-jquery  
category: "jquery"  
tags: ["jquery", "html", "jquery validate"]  
reading_time: 2 minutes  

---

# How do I check if an element is hidden in jQuery?

How do I [check if](https://www.mindstick.com/forum/12878/how-to-check-if-an-asp-dot-net-file-upload-control-has-a-file-in-jquery) an element is [hidden](https://www.mindstick.com/forum/2303/skip-validating-field-from-hidden-div) in jQuery?

## Replies

### Reply by Aryan Kumar

There are two ways to [check](https://yourviews.mindstick.com/story/2248/never-forget-to-check-these-specifications-before-buying-a-mobile-phone) if an element is hidden in jQuery:

1. **Use the .is(":hidden") selector.** This selector will select all elements that are currently hidden, regardless of their CSS properties. For example, the following code will check if the element with the ID myElement is hidden:

Code snippet

```plaintext
if ($(myElement).is(":hidden")) {
  // Do something if the element is hidden
}
```

1. **Use the .css("display") method.** This method will return the current value of the display CSS property for the element. If the value is none, then the element is hidden. For example, the following code will check if the element with the ID myElement is hidden:

Code snippet

```plaintext
if ($(myElement).css("display") === "none") {
  // Do something if the element is hidden
}
```

Which method you use depends on your specific needs. If you only need to check if the element is hidden, then the .is(":hidden") selector is the simplest option. However, if you need to check the element's CSS properties, then the .css("display") method is more flexible.

Here are some additional notes about checking if an element is hidden in jQuery:

- Elements with visibility: hidden or opacity: 0 are considered to be hidden, even though they may still consume space in the layout.
- The .is(":hidden") selector will also select elements that are currently blocked by other elements. For example, if an element is hidden by another element with a higher z-index, then the .is(":hidden") selector will still return true.
- If you need to check if an element is visible, then you can use the .is(":visible") selector. This selector will return false for any element that is hidden, regardless of its CSS properties.


---

Original Source: https://www.mindstick.com/forum/158054/how-do-i-check-if-an-element-is-hidden-in-jquery

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
