I have this code. How do I set a different CSS style on each of the outcomes – correct & incorrect.
The CSS styles are wordglow1 and 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');
}
}
});
These are the class’s I need to assign to the conditions…
<div id="rightanswer" class="wordglow2"></div>
<div id="wronganswer" class="wordglow"></div>
.addClass is your friend