jQuery第48天学习实践
发表时间: 2023-09-16 22:09
<!DOCTYPE html><html> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE-edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title></title> <style> button { background: none; } </style> </head> <body> <button>第一个按钮</button> <button>第二个按钮</button> <button>第三个按钮</button> <button>第四个按钮</button> <button>第五个按钮</button> <button>第六个按钮</button> <script src="../js/jquery-3.7.1.js"></script> <script> $("button").click(function(){ $(this).css("background", "#fcf").siblings("button").css("background","none"); }); </script> </body></html>