In my word game, when the correct letters spell the word, it will disappear with “wordglow2”. At the moment it does this to the word. If I wanted to make the whole row disappear when a correct word was spelt on it, how would I do that?
$(".drop").droppable({
drop: function(event, ui) {
word = $(this).data('word');
guesses[word].push($(ui.draggable).attr('data-letter'));
console.log($(event));
console.log($(ui.draggable).text());
console.log('CHECKING : ' + $(this).text() + ' against ' + $(ui.draggable).text().trim());
if ($(this).text() == $(ui.draggable).text().trim()) {
$(this).addClass('wordglow3');
} else {
$(this).addClass('wordglow');
}
console.log('CHECKING : ' + $(this).text() + ' against ' + $(ui.draggable).text().trim());
console.log(guesses);
if (guesses[word].length == 3) {
if (guesses[word].join('') == word) {
$('td[data-word=' + word + ']').addClass("wordglow2");
} else {
$('td[data-word=' + word + ']').addClass("wordglow4");
guesses[word].splice(0, guesses[word].length);
}
}
I would have though it would have been like this, but it didn’t work…
if (guesses[word].length == 3) {
if (guesses[word].join('') == word) {
$('td[data-word=' + word + 'td' + ']').addClass("wordglow2");
As per the comments:
Currently you will have
Update it so it reads
and then update your jQuery code, so it does
This will then apply the background colour to all of the cells within your row.