question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Recommended way to clear input field after selection is made?

See original GitHub issue
  • vue-autosuggest version: 1.4.1
  • node version: 7.10.0
  • npm (or yarn) 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:closed
  • Created 5 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
darrenjenningscommented, Oct 1, 2019

@inDigiNeous latest version starting in version 2.0 uses v-model so you can clear it like any regular input in Vue

1reaction
NateWrcommented, Apr 27, 2018

😮 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! 👍

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found