2
rox79
4y

hmm I need suggestion.

Actually am working on autocomplete address (zip code to autofill countries,state,city) feature.

But am confused with events. For example I have input field user is typing zip code so on which event I call my api example onsubmit or onChanged.

I seriously don't want to use onSubmit. But if I use onChange event than it will start searching for every character :(

any advice

Comments
  • 2
    oninput triggers for every character

    onchange won't be suitable for this case

    onblur if you want to trigger after user moves to another input
  • 0
    I think you confused onchange with oninput, onchange does not trigger for every character, it might be suitable
  • 0
    @theabbie naa oninput is same like onchange.. triggring after every character I type
  • 0
  • 0
    @24th-Dragon hmm thanks I was going to test this as this is something new for me but then @theabbie suggested onBlur and I guess onBlur will work in my case :) Thanks to both of you
  • 1
    @theabbie hmm am on react and I don't know on onChange as soon as I type my function triggred :( anyways going with onBlur
  • 0
    OnChange is not the same as OnInput.
  • 0
    Dont use onchange use onkeyup
Add Comment