<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="js/jquery.min.js"></script> <title>Document</title> <style> button:nth-child(1) { /* background-color: red; */ } </style> </head> <body> <BUTTON>快速</BUTTON> <BUTTON>快速</BUTTON> <BUTTON>快速</BUTTON> <BUTTON>快速</BUTTON> <BUTTON>快速</BUTTON> <BUTTON>快速</BUTTON> <BUTTON>快速</BUTTON> <BUTTON>快速</BUTTON> <script> $('button').click(function() { $(this).css('background', 'pink'); //siblings()函数是筛选出此元素的所有兄弟元素,详情可以查看筛选方法 $(this).siblings().css('background', ''); }) </script> </body> </html>