on pressing enter change the focus to the next input field

Solutions on MaxInterview for on pressing enter change the focus to the next input field by the best coders in the world

showing results for - "on pressing enter change the focus to the next input field"
Marie
08 Jul 2020
1  public focusNext(e) {
2    console.log('here');
3    try {
4      for (let i = 0; i < this.inputsArraY.length; i++) {
5        if (e.code === 'Enter' && e.target.id === this.inputsArraY[i]) {
6         document.querySelector(`#${this.inputsArraY[i+1]}`)//.focus()
7        }     
8      }
9    } catch (error) {
10      console.log(error);
11      
12    }
13  }