5
I got this little FIDDLE to exemplify my problem.
HTML
<ul>
<li>1</li>
<li>2</li>
<li>3</li>
<li>4</li>
<li>5</li>
</ul>
<h1>"I have " + count + " list items"</h1>
JAVASCRIPT
var count = 0;
$("li").each(function(){
count++;
});
The variable count
Javascript will have the number of li
's of ul
.
How do I show up at the h1
of HTML, the variable count
?
Do not prefer to print all text on
h1
? In fact, I think it’s the only solution– CesarMiguel
Appear all text like this? I wanted it to appear: "I have
count
list items"– msm.oliveira