I am setting up a tumblr blog, and I want to apply certain styles and rules depending on the number of photos present in the photoset. I am not sure how to get the number of children present in each message when each column has the same class. If this is the code that tumblr generated:
<div class="photoset">
<img />
<img />
</div>
<div class="photoset">
<img />
<img />
<img />
</div>
How do I get jQuery to return the number of elements in the first and second instances (i.e. 2 and 3)?
I tried using $('.photoset img').length();, and this gives me the total number of all elements present (i.e. 5 in this case).
Any help would be greatly appreciated!
Cheers, Scott
source
share