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');
}

guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x