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');
精彩评论