我有这个代码。如何在每个结果上设置不同的 CSS 样式 - 正确和不正确。
CSS 样式是 wordglow1 和 wordglow2...
$(".drop").droppable({
drop: function(event, ui) {
word = $(this).data('word');
guesses[word].push($(ui.draggable).attr('data-letter'));
console.log(guesses);
if (guesses[word].length == 3) {
if (guesses[word].join('') == word) {
alert('Correct');
} else {
alert(guesses[word].join('') + ' is the incorrect spelling. The word is spelt - ' + word)
}
$('td[data-word=' + word + ']').droppable('disable');
}
}
});
这些是我需要分配给条件的类...
<div id="rightanswer" class="wordglow2"></div>
<div id="wronganswer" class="wordglow"></div>