题解 | #事件委托#

事件委托

https://www.nowcoder.com/practice/02866b3ce7f8420c8b5d22f483c5fcc0

{"html":"<!DOCTYPE html>\n<html>\n\n<head>\n    <meta charset=\"UTF-8\">\n    <style>\n       /* 填写样式 */\n    </style>\n</head>\n\n<body>\n    <ul>\n            <li>.</li>\n            <li>.</li>\n            <li>.</li>\n        </ul>\n    <!-- 填写标签 -->\n    <script type=\"text/javascript\">\n        // 填写JavaScript\n        document.querySelector('ul').onclick = event => {\n            if (event.target.tagName.toLowerCase() === 'li') {\n            event.target.innerText = '..'\n        }\n   \n}\n    </script>\n</body>\n\n</html>","css":"","js":""}

全部评论

相关推荐

评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务