📜  按回车键将焦点更改为下一个输入字段 - Javascript 代码示例

📅  最后修改于: 2022-03-11 15:02:14.133000             🧑  作者: Mango

代码示例1
public focusNext(e) {
    console.log('here');
    try {
      for (let i = 0; i < this.inputsArraY.length; i++) {
        if (e.code === 'Enter' && e.target.id === this.inputsArraY[i]) {
         document.querySelector(`#${this.inputsArraY[i+1]}`)//.focus()
        }     
      }
    } catch (error) {
      console.log(error);
      
    }
  }