开发者

How do I rewrite this jQuery more efficiently?

How do I rewrite this code to change a class name with jQuery more efficiently?

$(function() {
    $('#container').click(function(event) {
      var element = event.currentTarget;
      /* Toggle the setting开发者_开发知识库 of the classname attribute */
      element.className = (element.className == 'card') ? 'card flipped' : 'card';
    });
});


$(this).toggleClass('flipped');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜