事件委托是指将事件绑定到目标元素的父元素上,利用冒泡机制触发该事件
ulEl.addEventListener('click', function(e){ var target = event.target || event.srcElement; if(!!target&&target.nodeName.toUpperCase() === "LI"){ console.log(target.innerHTML); } },false )
posted on 2021-04-06 17:10 zhishiyv 阅读(56) 评论(0) 编辑 收藏 举报
Powered by: 博客园 Copyright © 2024 zhishiyv Powered by .NET 9.0 on Kubernetes