jQuery排他思想案例之点击按钮方法教程(附代码)
- <button>按钮</button>
- <button>按钮</button>
- <button>按钮</button>
- <button>按钮</button>
- <button>按钮</button>
- <button>按钮</button>
- <button>按钮</button>
- <script>
- $(function() {
- $('button').click(function() {
- $(this).css('background', 'pink');
- $(this).siblings().css('background', '');
- // $(this).siblings('button').css('background', '');
- });
- });
- </script>
复制代码
|
|