Monday 31 March 2014

JQuery Check element is block or hidden.

Introduction:

Here I will explain how to check any element like div,p,input is block or hidden.

In JQuery we can show/hide element by show(), hide() functions but how would we test element is visible or not so here is solution for check visibility of element.

Just need to check visible property.

Code:
$(element).is(":visible");


Example:





Suppose you want to check visibility of div element then just select div.

var b = $('div.test').is(":visible");;
alert(b);


This will alert true if div with class test is visible and return false if div with class test is hidden.



No comments :

Post a Comment