[Hidden-tech] Understanding dynamic typeahead/autosuggest posts

Alan Frank alan at 8wheels.org
Wed Jul 24 17:10:43 UTC 2019


I have been teaching myself PHP, JS, and web development with the help 
of a series of online searches.  In the modern world, it seems that the 
answer to every programming question is somewhere on the web.  And 
although 99% of the answers are clear, I have run into one question 
which has many answers and I don't understand any of them--they provide 
code, but I don't understand where to put it nor which elements of the 
answer need to be modified to work with my code.

Specifically, I am trying to do an autosuggest list--the user types BAR 
and the form automagically provides suggestions such as Barack Obama, 
Barbie Dolls, and bargain basement.  Everybody likes the 
Twitter/Bootstrap typeahead module and I have been able to get it to 
work with form elements created at page load time.  The issue is that I 
need to get it to work with dynamic elements (and worse, with elements 
that change whether they want this behavior based on radio button 
selection).  I have found several solutions to this problem:
https://stackoverflow.com/questions/22321101/twitter-typeahead-autocomplete-to-dynamically-added-inputs
https://stackoverflow.com/questions/15094680/add-a-listener-to-an-element-that-is-dynamically-added/15094730#15094730
https://github.com/twitter/typeahead.js/issues/224
Good--I'm glad that the experts have run into this and figured out how 
to work around it.  I am looking for guidance on how to go the last few 
inches to actually making it work on my own page.  And the posts above 
are all several years old, so I'm guessing that trying to follow up 
there will not get much attention.

Thanks,

Alan


Google

More information about the Hidden-discuss mailing list