-1

I am using bootstrap tokenfield to instrument my email textbox to support multiple email input.

User types letter a in the email textbox (the one with red font in the picture) . A list of matched emails show up in a selection menu (the box that shows the email abc@gmail.com in black)

After the user clicks and selected an email, the selected value is not captured. At the end I only got a letter a in the email textbox

enter image description here

How can I fix this issue?

Anthony Kong
  • 37,791
  • 46
  • 172
  • 304

1 Answers1

0

It turns out I am also using Fastclick in my project. It swallowed the click event of the selection menu (of css class tt-selectable) used by bootstrap-tokenfield

At the end it is my solution. Fork the twitter typeahead.js project and change the following line from

$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val, 
that.displayFn(suggestion)).addClass(that.classes.suggestion + " " 
+ that.classes.selectable);

to

$el = $(that.templates.suggestion(context)).data(keys.obj, suggestion).data(keys.val, 
that.displayFn(suggestion)).addClass(that.classes.suggestion + " " 
+ that.classes.selectable + " needsclick");

The additional css class needsclick will disable fastclick on this elements

Anthony Kong
  • 37,791
  • 46
  • 172
  • 304