const input = document.getElementById('input');
input.addEventListener('input', event => {
const value = event.target.value.trim().toLowerCase().toString();
document.querySelectorAll('.ul li').forEach(node => {
if (value !== '' && !node.textContent.toLowerCase().includes(value)) {
node.classList.add('hide')
} else {
node.classList.remove('hide');
}
if (value == '') {
node.classList.add('hide');
}
});
});
Окончательный код, кому нужен
<div class="search input-group" >
<input type="search" name="" class="input__form" id="input" placeholder="Поиск товаров..">
<ul class="ul list-group">
<li id="item1" class="item4 list-group-item hide">TWS Apple Airpods Pro 1</li>
<li id="item1" class="item4 list-group-item hide">TWS Apple Airpods Pro 2</li>
<li id="item1" class="item4 list-group-item hide">TWS Apple Airpods Pro 3</li>
</ul>
</div>