I'm saving some elements into an array to later be able to determine which one of them I clicked on, but my method doesn't work. (later, I'm going to use the array index to calculate some things). The if statement below never becomes "true". What is wrong? Halp!
$(document).ready(function() {
var teamList = [];
$('#team-list').children(".team-member").each(function() {
teamList.push($(this));
});
$('#team-list').on("click", ".team-member", function() {
console.log("click");
for (i = 0; i < teamList.length; i++) {
console.log("The element was");
console.log($(this));
console.log("and the loop is on");
console.log(teamList[i]);
if ($(this) == teamList[i]) {
console.log("it was true");
}
};
});
});