1
I am trying to count child elements of a parent element with jQuery in the HTML I created, but it is returning the value 'Undefined'.
<div class='dataGrid'>
<div class='dataGrid-item'></div>
<div class='dataGrid-item'></div>
<div class='dataGrid-item'></div>
<div class='dataGrid-item'></div>
<div class='dataGrid-item'></div>
<div class='dataGrid-item'></div>
</div>
And the jQuery I incremented was.
<script>
$(document).ready({
var qtdGrid = $('div.dataGrid div.dataGrid-item').lenght;
window.alert(qtdGrid);
});
</script>
In the console no error is returned, only in the 'Undefined' Alert'.
I’m Voting to close this Question as off-topic because ...
– ElvisP