I'm looking for all divs with class=.task that aren't hidden by angular directives ng-show/ng-hide. However, I would also like to check the parent div is not hidden but I can not for the life of me figure out the proper selectors. There is no parent selector and .ng-hide isn't inherited from what I can tell.
This is what I have for finding divs that aren't hidden:
var tasks = $('div:first').find('.task').not('.ng-hide');
If it's not possible I guess I can repeat the ng-show on the children divs but it seems a cleaner if I could keep it solely on the parent div.
尝试:not
选择器。
var tasks = $('div:first').find('.task:not(".ng-hide")');
JQuery中有一个用于父项的选择器,称为parent()
。
All I needed was the :visible selector because angular's ng-hide/ng-show work by setting display: none on the hidden element which :visible can react to. The solution...
var tasks = $('div:first').find('.task:visible');
Credit to @ndimatteo. If they post the answer I'll accept theirs.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.