需要一些帮助。管理创建一个jQuery来改变被点击后的按钮的类,但我需要你点击一个新的按钮类被从其他人中删除。点击新按钮后删除课程
我在尝试,但我不能。我尝试了一些方法,但每当我尝试时,我都可以删除所有内容,然后单击与新类别不同的按钮。
任何人都可以帮助我吗?
$(document).ready(function() {
$('div#filters-container button').click(function() {
var id_button = $(this).val();
$("#" + id_button + "").addClass("cbp-filter-item-active");
});
});
.cbp-filter-item-active {
background-color: #5d5d5d;
color: #fff!important;
border-color: #5d5d5d
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<div id="filters-container">
<button value="0" id="0" href="videos2-carrega.asp">Todos</button>
<button value="1" id="1" href="videos2-carrega.asp?cat=1">Família</button>
<button value="2" id="2" href="videos2-carrega.asp?cat=2">Finanças</button>
<button value="3" id="3" href="videos2-carrega.asp?cat=3">Propaganda</button>
<button value="4" id="4" href="videos2-carrega.asp?cat=4">Empreendedorismo</button>
</div>
感谢您的关注。
只显示你写的代码,而不是小提琴链接 – 2014-11-04 11:24:43
代码pleeeeazzz。您将无法添加链接到jsfiddle,直到您在那里显示代码。 – nicael 2014-11-04 11:25:00
请输入密码+小提琴。 – sinisake 2014-11-04 11:25:35