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.

"keyup" or "input" best practice for autocomplete input field?

See original GitHub issue

In the https://angular.io/tutorial/toh-pt6#search-by-name tutorial, for the input field, the event “keyup” is used in the example: <input #searchBox id="search-box" (keyup)="search(searchBox.value)" />

But wouldn’t it be a better (best) practice to use the “input” event instead? Such that the input field also reacts on copy/paste via mouse for example?

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
simonferndrigercommented, Jul 19, 2018

Yes, that is true for sure. But why not lead with a good example? Chances are high, that this practice will influence future developments.

1reaction
sreevani-ship-itcommented, Dec 4, 2018

Current document uses the input event.

Read more comments on GitHub >

github_iconTop Results From Across the Web

For a JavaScript autocomplete search box, must we use the ...
Entering input with keyboard (includes holding down a key). Triggers: keydown , keypress , input , keyup · Deleting input ( Backspace /...
Read more >
How to implement autocomplete with JavaScript on your website
Go deep into autocomplete - the what and why, and the data and code to implement your own search autocomplete with JavaScript.
Read more >
Place Autocomplete | Maps JavaScript API - Google Developers
The Place Autocomplete sample demonstrates how to use the Place Autocomplete widget to provide a type-ahead search box. The radio buttons allow you...
Read more >
How To Build an Autocomplete Component in React
In this article you will learn how to build an autocomplete component in React using local state and some event handlers.
Read more >
Building Autocomplete Search Component from Scratch
The keyup listener will be added to the input field using rxjs Observable fromEvent method on carInput variable which can notify us of...
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