📅  最后修改于: 2022-03-11 15:01:06.807000             🧑  作者: Mango
const menu_items = document.querySelectorAll('li');
function getInputValue() {
// Selecting the input element and get its value
var inputVal = document.getElementById("myInput").value;
menu_items.forEach(item => {
if (item.textContent.includes(inputVal)) {
console.log(inputVal + " is in the list.")
}
})
}