简体   繁体   中英

Autocomplete the search in nav list by refresh with JQuery

Currently I am working on a search box which works for a list on the navbar, I want the list could be refreshed while users enter the key words, in another word, there would be only the matched word showed in the list.

here is the code: http://jsfiddle.net/x69chen/sbAR6/

I cannot figure out how to reset the list to empty first, and then replace the list only the matched ones. I tried this

    $( "$nav-list123" ).empty();

But is does not work. Could anyone gives some hits? thanks

To reset the list:

$("#nav-list123").empty();

It works for me in the JS fiddle you show.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM