I can't write the total numbers of divs that have the same class name, when I try to do it it just print [object NodeList]. How can I get the amount of div classes and print them on the document? Thanks a lot, here's the code:
<script>
var elementos = document.querySelectorAll('#container .foo')
document.write(elementos);
</script>
use .length
property:
document.querySelectorAll('#container .foo').length;
using jquery:
$('#container .foo').length;