/    Sign up×
Community /Pin to ProfileBookmark

Help needed in implementing incremental search

Hi,

In my application, I need to implement incremental search.
We have a String array which contains all the elements from A to Z.
And when user types a character like “A” in a text box, it should pick all the elements starting with “A” such as Alice, Austin, Austria, Anil… from String array and display in another textarea.
Later, when user types “u”, then it should pick all the elements starting with “Au” such as Austin, Austria…

I am thinking of using onkeyup event.
<input type=”text” id=”names” onkeyup=”return onKeyPressFunction(this.id);” />

Question is : A request is made when user types character “A” inside a textbox and again when user types “u”, a request is made and so on.
So, whenever user types something in a text box, a request is made.

How to avoid multiple request whenever user types in text box?

Thanks in advance,

Chinnu

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @chinnu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.25,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...