📌  相关文章
📜  在输入字段内按下退格键时删除一个类 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:03:14.608000             🧑  作者: Mango

代码示例2
document.addEventListener("keydown", function (event) {
    if (event.key == "Backspace") {
        console.log("Backspace Pressed");
        var plainlist = document.querySelectorAll('li.red');
        console.log(plainlist);
        plainlist.forEach(item => {
            item.classList.remove("red");

        })
    }
})