Sahan
Sahan

Reputation: 1467

Keep Twitter Typeahead suggestion dropdown open

At the moment I cannot design the typeahead template I have with Google chrome Dev tools because when ever i open it as it's stated in Twitter Docs

#Input Control Loses Focus#

deactivate typeahead
close dropdown menu
remove hint
clear suggestions from dropdown menu

I do not need this behaviour. I want the dropdown to disappear only when the user click something else on the body,

Any help really appreciated

Upvotes: 1

Views: 2001

Answers (1)

Dhiraj
Dhiraj

Reputation: 33628

You can do something like this

.on('blur', function(){
  ev = $.Event("keydown");
  ev.keyCode = ev.which = 40;
  $('.typeahead').trigger(ev);
  return true;
});

Here is a DEMO (start typing t in the demo)

Here is the reference

Upvotes: 3

Related Questions