Topic: Autocomplete reset
Hi,
I have an autocomplete that is used to add multiple items to a list.
When the user selects an item, it automaticaly fills the input with the item title. I'd like instead to reset the input to blank after selection, just like it was before the search.
I tried
myAutocomplete.initSearch('')
but this only triggers an empty search and does not change the input value.
And this has no effect
myAutocompleteInput.value = ''
kpienkowska staff answered a year ago
Here is a snippet with the code you need: https://mdbootstrap.com/snippets/standard/kpienkowska/5454760
The value that you will use is logged with the console log.
Nairod pro premium priority commented a year ago
Thank you very much
DashMarketingGroup pro premium priority commented a year ago
Why is this code snippet gone? If I click the link I get a 404 error. This would be a very helpful snippet!
kpienkowska staff commented a year ago
I've prepared a new version: https://mdbootstrap.com/snippets/standard/kpienkowska/5542389
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Answered
- User: Pro
- Premium support: Yes
- Technology: MDB Standard
- MDB Version: MDB5 6.4.0
- Device: ASUS ExpertBook B5302CE
- Browser: Chrome
- OS: Windows 11
- Provided sample code: No
- Provided link: No