There are many threads and samples out there about typeahead (https://gist.github.com/1866739) and also a forked version, but I simply cannot find anything on allowing the user to “add” what he/she has written, if it’s not already in the list. If the user continues typing when there are 0 results, the results ul is hidden…


I’d like to add an <li> that is the value of input (that I know how to do), but the dropdown disappears if the user continues typing input and there are 0 matches.
When I come down to 1 match “count li” for amount: “1” works, but to count 0 doesn’t work, it’s as if the entire list is “repopulated” again if there are no matches.
Links, hints, or examples would be much appreciated!
I really don’t get what is the issue, but I’m assuming that’s because it is to easy and you just don’t see it.
Instead of having a button to make the user to add it’s own interest (instead of selecting it from the list – your
source), you could simply accept the user value using$('.typeahead').val();here is a live demo, fell free to add your own items and press Enter in order to effectively have them as the
typeheadsource.in your page, you could actually use
$.ajax()to add the new item to your database at once, or wait until the user submit the form and add it.