Check If Layer Is Visible Or Not Using JQuery

You can check if a layer like DIV or SPAN is visible or not in JQuery with the visible attribute.

?View Code JAVASCRIPT
1
2
3
if ($("#MY_DIV_ID").is(":visible")) {
  alert('visible!');
}

Donations appreciated. Every little $ helps. Or click Google +1

Detect If Layer Is Visible Or Hidden Using JQuery

Use the following Javascript code below to check if a layer (div, span, etc) is visible or hidden.

?View Code JAVASCRIPT
1
2
3
4
<script>
if ($('#layer_id').is (':visible')) alert ("visible");
if ($('#layer_id').is (':hidden')) alert ("hidden");
</script>

Donations appreciated. Every little $ helps. Or click Google +1

Related Posts with Thumbnails