Код:
<input type="text" onkeyup="myFunction()" id="myInput" placeholder="Search">
<p>elit. Placeat mollitia, nam voluptatibus maxime sed, illum veniam harum quos getFunctionInfoValue? Rerum consectetur etFunctionInfoValue quia quaerat quos id. liquam repudiandae ducimus asperiores iusto illum!</p>
<ul id="myUL">
<li><a href="#"> getFunctionInfoValue, </a></li>
<li><a href="#"> consectetur adipisicing elit.</a></li>
<li><a href="#"> Placeat mollitia, nam voluptatibus</a></li>
<li><a href="#"> setFunctionInfoValue</a></li>
<li><a href="#"> axime sed, illum veniam harum quos? Rerum consectetur</a></li>
</ul>
</div>
Код:
function myFunction() {
var input, filter, ul, li, a, i;
input = document.getElementById('myInput');
filter = input.value.toUpperCase();
ul = document.getElementById('myUL');
li = ul.getElementsByTagName('li');
for (i = 0; i < li.length; i++) {
a = li[i].getElementsByTagName('a')[0];
if (a.innerHTML.toUpperCase().indexOf(filter) > -1) {
li[i].style.display = "";
} else
li[i].style.display = "none";
}
}