Categories
Programming

If an element is visible or hidden using jQuery

Usually you can trust the .toggle function (or .slideToggle) to hide or show whatever you want it to. But occasionally you need to know if something is hidden or shown.

var isVisible = $(‘#giftMsg’).is(‘:visible’);
var isHidden = $(‘#giftMsg’).is(‘:hidden’);

Leave a Reply

OR LOG IN WITH




Your email address will not be published. Required fields are marked *