0
So I'm assuming you want to do something when all data-answer=true have been clicked inside the div - You really don't need the array of true answers then as you can do a check on each click $('.answer').click(function(){ var $el = $(this); if($el.data('answer')){ // if data-answer=true ...