jQuery – Check if an element is visible or not
We can easy to check whether if an HTML element is visible or not by using .is()
method. Here is an example:
example.js
var element = $('#popup');
if (element.is(':visible')) {
console.log('The element is visible');
} else {
console.log('The element is hidden');
}