If we are writing some code using jQuery and want to know if a particular element in your page is visible or hidden you can do that using is() method,
Code Example:
<div id="hiddenEle" name="hiddenEle" style="display:none">This div is hidden</div>
<div id="visibleEle" name="visibleEle" style="display:block">This div is visible</div>
console.log($('#hiddenEle').is(":visible"));
console.log($('#visibleEle').is(":visible"));
Output:
false
true
βοΈjsfiddle: https://jsfiddle.net/0wxy8ect/4/
More Posts related to jQuery,
- jQuery: Check if an element exists or not
- [jQuery] Uncaught ReferenceError: $ is not defined at index.html:5
- Make div element draggable using jQuery
- jQuery : Move to top of the page
- Dynamically Obtaining Browser Screen Width and Height with jQuery [Updated 2023]
- How to check if an element is hidden using jQuery code?
- Redirect page using jQuery
- Disable jQuery button after being click
More Posts:
- Android : Exception raised during rendering: action_bar API 22 - Android
- Limit scrollback rows in macOS Terminal - MacOS
- Setup Git + Visual Studio Code Tutorial - Git
- Python: How to POST Json Data with HTTP Request - Python
- Correct way to Get the Current Date in Java 8 or above - Java
- Installing Google Cloud macOS SDK - Google
- Calculate Area of ellipse - C-Program
- How to use SSH in Windows Terminal - Windows