JavaScript Filter List

  • JavaScript
  • HTML/CSS
  • C
  • C++
  • C#
  • SQL
  • Java
  • PHP
  • TypeScript
  • Golang
  • Ruby
  • Swift
JavaScript
              
const txtType = document.getElementById("txtType");

txtType.addEventListener("input", (e) => {
  const filter = e.target.value.toUpperCase();
  const list = document.querySelectorAll('#list li');

  list.forEach((el) => {
    const lang = el.textContent.toUpperCase();
    el.style.display = lang.includes(filter) ? "" :"none";
  });
});