code_junkie

In jQuery, how can I tell if the current object is hidden or not

Nov 14th, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.34 KB | None | 0 0
  1. $('myObject').show();
  2.  
  3. if ($('myObject').css('display') == 'none') {
  4. $('myObject').show();
  5. }
  6.  
  7. if ($('#something').is(':hidden')) { }
  8.  
  9. if ($('#something').is(':visible')) { }
  10.  
  11. $('#something:hidden').show();
  12. $('#something:visible').hide();
  13.  
  14. var isVisible = $('myObject').is(':visible');
  15. var isHidden = $('myObject').is(':hidden');
Add Comment
Please, Sign In to add comment