私のプログラムには、td クラスに必要な「正解」というクラスがありますが、実際に問題が発生しています。
ここで、「正しい単語」クラスを「spellWord」に追加します。しかし、代わりに「td」クラスに追加する方法。
var spellWord = $('.highlight-problem .drop-box');
if (!spellWord.filter(':not(.occupied)').length) {
var wordIsCorrect = 0;
spellWord.each(function () {
if ($(this).parents('td').data("letter") == $(this).find("div").data("letter")) {
console.log('letter is: ' + $(this).find("div").data("letter"))
wordIsCorrect++;
}
});
console.log(spellWord.length + ' , ' + wordIsCorrect);
if (spellWord.length == wordIsCorrect) {
spellWord.addClass('right-word');
$(right).css('visibility', 'visible');
$(wrong).css('visibility', 'hidden');
score.right++;
$('.score').html(score.right + "/2").show();
setTimeout(function() {
successSound.play();
}, 200);
などを試してみました。
spellWord.addClass('td').addClass('right-word');
と
$('.td').addClass('right-word');
しかし、それを機能させることはできません。フィドル: http://jsfiddle.net/smilburn/Dxxmh/93/