javascript - :visible length returning 0 when item is visible -
i have if statement check if div has nothing visible under it, , if so, hide siblings of child element.
var $remainingprojects = $searchproject.show().filter(function () { var text = $(this).text().replace(/\s+/g, ' ').tolowercase(); return !~text.indexof(val); }).parents('.srcprojects'); var $remainingprojectscontainer = $remainingprojects.parents('.projectscontainer'); $remainingprojects.hide(); $remainingprojectscontainer.each(function() { if($(this).children('.srcprojects:visible').length == 0){//this line console.log($(this).children('.projectschildren').html()); $(this).children('.projectschildren').hide(); $(this).children('.projectschildren').siblings('.destarrow').hide(); $(this).children('.projectschildren').siblings('.destproject').hide(); } });
it seems working, still hiding siblings of child element one:
<div class="srcprojects" style=""></div>
everything else fulfills condition has style set display:none;
shown below:
<div class="srcprojects" style="display: none;"></div>
i have multiple srcprojects under each container. because it's search, or hidden. want siblings hidden if none of srcprojects under container visible.
edit: added surrounding code context.
have tried:
$(this).children('.srcprojects').is('visible');
edit
it should this:
$(this).children('.srcprojects').is(':visible');
this not work inline elements in chrome.
Comments
Post a Comment