<input type="text" id="searchInput" onkeyup="filterList()"> <ul id="itemList"> <li>Apple</li> <li>Banana</li> <li>Cherry</li> <li>Date</li> <li>Fig</li> </ul> <script> function filterList() { var input = document.getElementById("searchInput").value.toLowerCase(); var items = document.querySelectorAll("#itemList li"); items.forEach(function(item) { if (item.textContent.toLowerCase().includes(input)) { item.style.display = "list-item"; } else { item.style.display = "none"; } }); } </script>