Duncan Lukkenaer
Duncan Lukkenaer

Reputation: 13914

Turn off typeahead autocomplete temporarily

I am using bloodhound to suggest products from a list. Once selected, input fields will automatically be filled in for the user.

When a user has selected a product, the autocomplete suggestions must be disabled temporarily - but the input must still be changeable. If a user presses a button to deselect the product, all input fields will be cleared and the suggestion engine must be enabled again.

I am trying to create two functions: enableSuggestions() and disableSuggestions(). Is there any way to achieve this?

Upvotes: 1

Views: 1082

Answers (1)

Gilad Artzi
Gilad Artzi

Reputation: 3084

If you disable the input that typeahead works on, the suggestions will be disabled as well.

You can disable the input when a suggestion is selected (typeahead will trigger an event - typeahead:select) and remove the disabled attribute when the user deselects the product.

Upvotes: 0

Related Questions