Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Jquery - Get all visible children from a div Get

Tags:

jquery

I can get all the children of an element with this code

$('#all').children().each(function() { .... });

But how can i get all visible children with class "one" from id="all" ?

<div id="all">

    <div>asdd</div>
    <div class="one">content</div>
    <div class="one">bla</div>

    <div>
        ssss
        <div class="one" style="display:none">text</div>
    </div>

    <div class="one" style="display:none">blub</div>

</div>
like image 416
Peter Avatar asked Aug 22 '10 18:08

Peter


1 Answers

You can use the :visible filter selector like this:

$('#all').find('.one:visible').each(function(){
  // your code....
});
like image 182
Sarfraz Avatar answered Oct 16 '22 22:10

Sarfraz