W3 list search with modal?

This filter list is available on W3: https://www.w3schools.com/howto/howto_js_filter_lists.asp

I was wondering if I can put a modal inside those list items, so when a user click on a list item it pops
up with a modal, while keeping the search capabilities in check?

Thanks!

Yeah, of course. The search functionality just hides or shows items in a list, it doesn’t have anything to do with click events. Give each <li> a class and then you can easily assign a handler:

$('.list-item-modal').click(function(event) {
  // do stuff to show modal here
})