Recommended way to clear input field after selection is made?
See original GitHub issuevue-autosuggest
version: 1.4.1node
version: 7.10.0npm
(oryarn
) version: 5.8.0
What you did:
I’ve built a small wrapper for the autosuggest which takes a selection and adds it to a list. When the selection is made, I’d like to clear the input field so it’s ready for a new search.
I did this by overriding the getSuggestionValue()
method to return an empty string:
getSuggestionValue: function (data) {
return '';
},
I’m guessing that this breaks the accessibility of the component, since using the arrow keys to move down the list no longer displays the current selection in the input box.
Is there a recommended way to clear the input field after a selection is made? Thanks!
Issue Analytics
- State:
- Created 5 years ago
- Comments:7 (3 by maintainers)
Top Results From Across the Web
Clear Input fields after Submit using JavaScript
Clear multiple input fields after submit # · Use the querySelectorAll() method to select the collection. · Use the forEach() method to iterate...
Read more >Recommended way to clear input field after selection is ...
I've built a small wrapper for the autosuggest which takes a selection and adds it to a list. When the selection is made,...
Read more >HTML | Clearing the input field
To clear the entire input field without having to delete the whole thing manually Or what if there is already a pre-suggested input...
Read more >How To Clear Input Field on Focus
Learn how to clear an input field on focus. Click on the input field to clear it: Clear Input Field on Focus. Example....
Read more >How do I clear the previous text field value after submitting ...
try this: Using jQuery: You can reset the entire form with: $("#myform")[0].reset();. Or just the specific field with:
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@inDigiNeous latest version starting in version 2.0 uses v-model so you can clear it like any regular input in Vue
😮 The one question in the FAQ! Sorry, I totally missed that.
And thanks for the link to the storybook example code. I saw the storybook but was having trouble locating the source code. Very helpful! 👍