Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Prevent close on suggestion selected #1408

Closed
gremo opened this issue Oct 16, 2015 · 5 comments
Closed

Prevent close on suggestion selected #1408

gremo opened this issue Oct 16, 2015 · 5 comments

Comments

@gremo
Copy link

gremo commented Oct 16, 2015

Is there a way to prevent close the dropdown (.tt-menu) when a suggestion is clicked? I've searched a lot and none of these "hacks" works with current version:

@laCour
Copy link

laCour commented Jul 6, 2016

select is called when an item is selected (requires >=0.11). You can prevent the default behavior of this method by listening to the typeahead:beforeselect event and cancelling it with event.preventDefault(), like so:

$(document).on("typeahead:beforeselect", function(event, data) {
  event.preventDefault();
});

@zedtux
Copy link

zedtux commented Dec 12, 2016

@laCour your tip is not more working, do you know another way to do it now?

@laCour
Copy link

laCour commented Dec 12, 2016

@zedtux It still works for me. If you're not using jQuery my example wont work and would require changes. What version of typeahead are you using?

@zedtux
Copy link

zedtux commented Dec 12, 2016

I double checked and while I was thinking using the version 0.11, I just discovered that I'm using the version 0.10.5.

This should explain why it is not working.

I'm upgrading to 0.11.1 and I'll check again.

@zedtux
Copy link

zedtux commented Dec 12, 2016

Hell yeah, it's working now, thank you :)

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Development

No branches or pull requests

3 participants