I need a very simple 'knowledge check' which should compare the selected answers with the correct answers. I placed the correct answers into an array, and the selected answers into another array:
$(".kc_submit_1").click(function () {
var correctAnswers = ['true','true','true','true','true'];
var allAnswers = [];
$('.kc_answer').each(function() {
allAnswers.push($(this).val());
});
if (allAnswers==correctAnswers) {
alert ('Yahtzee');
};
})
The problem is that I never get a Yahtzee. The IF function is never true, which it should be if you clicked all items.
Fiddle: http://jsfiddle.net/dN6vt/