I want the script to count only the <li>
tags that are visible, but the code below counts even with display:none
.
Is there anything that does this?
I have the following HTML:
$( ".rodapeUlCat" ).append( $( "<li>" ) );
var n = $( ".rodapeUlCat li" ).length;
$( ".rodapeCat" ).text( " categorias( " + n + " )" );
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><ulclass="rodapeUlCat margin-top-25">
<li><h3><a href="/paginaSYS">tituloMenuSYS</a></h3></li>
<li><h3><a href="/paginaSYS">tituloMenuSYS</a></h3></li>
<li><h3><a href="/paginaSYS">tituloMenuSYS</a></h3></li>
<li style="display:none"><h3><a href="/paginaSYS">tituloMenuSYS</a></h3></li>
</ul>
<div class="rodapeCat"></div>