原生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();
}
}
原文地址:https://www.cnblogs.com/wssdx/p/11356567.html