请选择 进入手机版 | 继续访问电脑版

jQuery排他思想案例之点击按钮方法教程(附代码)

[复制链接]
查看1802 | 回复0 | 2020-3-5 17:11 | 显示全部楼层 |阅读模式
jQuery排他思想案例之点击按钮方法教程(附代码)
  1. <button>按钮</button>
  2.     <button>按钮</button>
  3.     <button>按钮</button>
  4.     <button>按钮</button>
  5.     <button>按钮</button>
  6.     <button>按钮</button>
  7.     <button>按钮</button>
  8.     <script>
  9.         $(function() {
  10.             $('button').click(function() {
  11.                 $(this).css('background', 'pink');
  12.                 $(this).siblings().css('background', '');
  13.                 // $(this).siblings('button').css('background', '');
  14.             });
  15.         });
  16.     </script>
复制代码

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

UID
1
贡献
387
丢币
38902
主题
4607
回帖
116
注册时间
2018-9-25
最后登录
2024-3-24