使用jquery在click上添加和删除类

时间:2016-09-07 07:34:47

标签: jquery

     <button class="fbutton btn pull-right filterevents " id="one" >School Events</button>
      <button class="fbutton btn pull-right filterevents" id="two" >Zone Events</button>
      <button class="fbutton btn pull-right filterevents" id="three" >My Events</button>

单击

时如何在每个按钮上添加课程

1 个答案:

答案 0 :(得分:0)

$(".fbutton").click(function (e) {
$(this).addClass("fcurrent").siblings().removeClass("fcurrent");
});

在此处查看演示http://jsfiddle.net/vVxM2/91/