【发布时间】:2018-02-18 20:37:16
【问题描述】:
我非常仔细地检查了浏览器中的控制台。
这一行:
document.getElementById("role_show_" + $(this).attr("id").substring(7, 9)).style.display = "block";
正常执行。但是当我像这样把它放在setTimeout 中时:
setTimeout(function() {
document.getElementById("role_show_" + $(this).attr("id").substring(7, 9)).style.display = "block";
}, 400);
控制台显示此错误:Uncaught TypeError: Cannot read property 'substring' of undefined
这里发生了什么?我确信所有其他代码行都未经编辑。
【问题讨论】: