Update - 1
var stringData = $.ajax({ url: 'digz/index/'+$(this).attr("id")+'.txt', async: false }).responseText;
var $newItems = $(stringData);
$('#container').isotope( 'insert', $newItems );
This feels like a 101 question but I just can't find the answer.
I have several buttons: A, B, C, etc. with each one loading a page of nested divs. Divs have the same layout. Parent div class=element. Say, click A loads 5 divs, B=7, C=4. I am trying to determine how many divs there are for each individual page (so I can run a numbered loop over all divs on the page 1, 2, 3, etc.)
$(".letter").click(function() {
var num = $('.element').length; alert(num);
// var num = $('.element').size();
});
What happens is that the alert with each page load is: 5 then 12 then 16. I can give more code but I hope this is clear enough.