Topic: Autocomplete reset
Nairod priority asked 1 year ago
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 = ''
Kamila Pieńkowska staff answered 1 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 priority commented 1 year ago
Thank you very much
DashMarketingGroup priority commented 1 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!
Kamila Pieńkowska staff commented 1 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
- ForumUser: Priority
- 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