小编use*_*599的帖子

jQuery将删除类onclick添加到div

我创建了下面的代码,它在第一次单击时通过类旋转成功旋转了箭头.

但是在第二次点击时,我希望箭头再次旋转回来.我尝试过,使用else,并在点击时删除类.但这没效果.任何建议或帮助都会很棒!

 $(document).ready(function(){
        $('#first').click(function(event) {
          $(".content.firstArrow").addClass("rotate");
        }); 
        $('#second').click(function(event) {
          $(".content.secondArrow").addClass("rotate");
        }); 
        $('#third').click(function(event) {
          $(".content.thirdArrow").addClass("rotate");
        }); 
        $('#forth').click(function(event) {
          $(".content.forthArrow").addClass("rotate");
        });       
   });
Run Code Online (Sandbox Code Playgroud)

html jquery addclass onclick removeclass

2
推荐指数
1
解决办法
2万
查看次数

标签 统计

addclass ×1

html ×1

jquery ×1

onclick ×1

removeclass ×1