当前位置:首页 > 前端 > 正文

原生JS获取元素,添加事件

// 获取所有input let inputAll = document.querySelectorAll(‘.table_input input‘); this.iddata = inputAll; // 向上 =38 if (item.keyCode === 38) { newIndex -= 8; if (inputAll[newIndex]) { inputAll[newIndex].focus(); } }