在我的代碼我已經加入這個變量剛開了jQuery的:不()選擇工作
var spellSpace = $('td[data-word=' + listOfWords[rndWord].name + ']').hasClass('.highlight-problem:not(.right-word)');
,並由於某種原因,它不會在此代碼
$('.next-question').click(function() {
$('td').removeClass('highlight-problem');
var r = rndWord;
while (r == rndWord) {
rndWord = Math.floor(Math.random() * (listOfWords.length));
}
$('td[data-word="' + listOfWords[rndWord].name + '"]').addClass('highlight-problem');
$('td[data-word=' + word + ']').removeClass('wrong-letter').removeClass('wrong-word').removeClass('right-letter');
var spellSpace = $('td[data-word=' + listOfWords[rndWord].name + ']').hasClass('.highlight-problem:not(.right-word)');
if (spellSpace) {
addMedia();
}
});
它只是將工作不返回addMedia()函數,我不知道爲什麼
任何人都可以告訴我我要去哪裏錯了嗎?
只是改變'hasClass'到'is'。 – caarlos0