jQuery:closest() 完成事件委托

2026-04-12 05:52:10

1、新建html文件

jQuery:closest() 完成事件委托

2、创建ul,li元素

jQuery:closest() 完成事件委托

3、设置li样式

jQuery:closest() 完成事件委托

4、引入jquery.js

jQuery:closest() 完成事件委托

5、点击li元素背景颜色发生切换改变

jQuery:closest() 完成事件委托

6、预览效果如图

jQuery:closest() 完成事件委托

7、点击按钮背景颜色发生切换

jQuery:closest() 完成事件委托

相关推荐
  • 阅读量:133
  • 阅读量:79
  • 阅读量:84
  • 阅读量:141
  • 阅读量:78
  • 猜你喜欢