Notifications
Clear all
BugOverflow
1
Posty
1
Users
0
Reactions
659
Widok
0
19/07/2021 9:35 am
Topic starter
example
1 Answer
0
19/07/2021 9:37 am
Topic starter
html
<input type="text" id="place-search" /> <ul> <li class="place-object"> <p>Place 1</p> </li> <li class="place-object"> <p>Place 2</p> </li> <li class="place-object"> <p>Place 3</p> </li> <li class="place-object"> <p>Place 4</p> </li> </ul>
jquery
$("#place-search").keyup(function (){ let query = $(this).val(); let pattern = new RegExp(query,"i"); $('.place-object').filter(function() { if(!$("p",this).text().match(pattern)) return true; $(this).show(); }).hide(); });