Show amount of LI within a UL.
I have the following HTML:
<ul class="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><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><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>
</ul>
<div class="rodapeCat">Outras Categorias (16)</div>
What I want to do is say Other Categories (16) in "16", it shows the amount of li
contained within ul
.
I made a Jquery:
$( ".rodapeUlCat" ).append( $( "<li>" ) );
var n = $( "li" ).length;
$( ".rodapeCat" ).text( + n + );
I wonder what I did wrong. length
counts the elements, right? Maybe the error is append
, but I do not know what to put in place.