I attempted two different methods of iterating through the arrays, but encountered the same error:
addClass is not function
First attempt using a for loop:
function game(){
var cards = $('.card');
function initialize(){
for(var x = 0; x < cards.length; x++) {
cards[x].addClass('wtf');
}
};
};
Second try utilizing the each method:
function game(){
var cards = $('.card');
function initialize(){
//Add random key values to pairs of cards
$.each( cards ,function(i, ele) {
ele[i].addClass('wtf');
});
};
};
Is there a more effective way to handle these types of arrays?