Tuesday, March 13, 2012

Is really visible JQuery Selector

Sometimes you will face a challange with jQuery Selectors that a DOM element is really visible or not.
Lets take following example

A Parent div is hidden and there is a txtname inside it which is not visible to the viewer as its parent div is not visible and based on this you need to take a action
so now you can use this extender selector to find out this is really visible or not

reallyhidden: function (a) {
var obj = $(a);
while ((obj.css(“visibility”) == “inherit” && obj.css(“display”) != “none”) && obj.parent()) {
obj = obj.parent();
return (obj.css(“visibility”) == “hidden” || obj.css(‘display’) == ‘none’);


No comments:

Post a Comment