I have a collection of div ...
<div class='happy person'><img src='#' /></div>
<div class='fat person'><img src='#' /></div>
<div class='joyous person'><img src='#' /></div>
<div class='grotesque person'><img src='#' /></div>
<div class='sad person'><img src='#' /></div>
which I selected using ...
var people = $('.person')
Results are stored in a class variable. jQuery saves the results of this selection as an array of HTMLDivElements, which they are.
Later I want to be able to look at this array and make some decisions regarding the class of each element. I read about a possible solution; but this fails, since I have no direct relation to the jQuery object.
How to get the class names of these divs in an array?
source
share