这里的代码写多余了,删除了一部分

Bug545-HuangHuiLing
1994836463@qq.com 2024-05-26 11:19:28 +08:00
parent f3b9fd8790
commit 85a3a9ce6a
1 changed files with 2 additions and 5 deletions

View File

@ -10,12 +10,9 @@ function fillInWord() {
if (isRead) Reader.read(word, inputSlider.value); if (isRead) Reader.read(word, inputSlider.value);
if (!isChoose) return; if (!isChoose) return;
const element = document.getElementById("selected-words"); const element = document.getElementById("selected-words");
let index = (String)(element.value).indexOf(word); localStorage.setItem('nowWords', element.value);
localStorage.setItem("nowWord",element.value); element.value = element.value + " " + word;
localStorage.setItem('selectedWords', element.value); localStorage.setItem('selectedWords', element.value);
if(index === -1){
element.value = element.value + " " + word;
}
} }
document.getElementById("text-content").addEventListener("click", fillInWord, false); document.getElementById("text-content").addEventListener("click", fillInWord, false);