<meta charset="utf-8"/> <button id="btn1" class="btn btn-primary btn-xs" value="today">今天</button> <button id="btn1" class="btn btn-primary btn-xs" value="today">今天</button> <button id="btn1" class="btn btn-primary btn-xs" value="today">今天</button> <button id="btn1" class="btn btn-primary btn-xs" value="today">今天</button> <script src="jq.js"></script> <script> $(function(){ //不能根据ID进行点击 id只能使用一次 只能使用class $('.btn').click(function(){ $(this).css('background',"#B1B1B1").siblings().css('background',""); }) }) </script>
点击按钮变色
最新推荐文章于 2024-08-11 00:31:29 发布