Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

错误指正 #59

Closed
ybbbzZ opened this issue Sep 30, 2019 · 1 comment
Closed

错误指正 #59

ybbbzZ opened this issue Sep 30, 2019 · 1 comment

Comments

@ybbbzZ
Copy link

ybbbzZ commented Sep 30, 2019

03-javascript基础中的32节-事件委托中的最后一串代码:
// 获取父节点,并为它注册click事件。 false 表示事件在冒泡阶段触发(默认) document.getElementById("parent-list").addEventListener("click", function (e) { // event.target 代表的是子元素。toUpperCase 指的是转换为大写字母 if (e.target && e.target.nodeName.toUpperCase == "LI") { // 真正的处理过程在这里 console.log("List item ", e.target.id, " was clicked!"); } }, false);
中的toUpperCase后应加括号,否则js事件绑定失败

@qianguyihao
Copy link
Owner

@ybbbzZ 感谢指正,已修复。国庆节快乐~

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants