Final Update - I'm marking this question resolved. I ended up going with Bootstrap Suggest for what I needed.
Update - With help from this post and some comments, I've been able to get this working with Input fields. I need some help getting it to run with div
, span
, or something that can take in text in-line.
I'm having trouble getting autocomplete or keydown events to trigger on dynamically created spans.
As you can see in my JSFiddle, I can bind the click
event on the new element and it works fine, but neither the keydown
or autocomplete
seems to work. Does Autocomplete HAVE to be on an input field? I thought it could work on the span
(which is the whole reason I was creating the span
in the first place).
I've tried following existing posts (like the ones listed below) but I've had no luck.
- How do you bind jQuery UI autocomplete using .on()?
- How can I add jquery ui autocomplete to a dynamically created element?
- Bind jQuery UI autocomplete using .live()
What could I be doing wrong? Am I overlooking something obvious? I've set breakpoints in the autocomplete function and it literally never hits them