click
HERE
to add animation to another element with jQuery
however, this animation can only be played once.
#test2:
click
HERE
to add animation to another element with jQuery
$('#test2 a.button').on('click', function(e){
e.preventDefault(); // prevent the link jump to top of the page
var animationName = "animated shake";
var animationend = "webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend";
$('#test2 input[name=firstName]').addClass(animationName).one(animationend,
function(){
$(this).removeClass(animationName);
});
});
});
// using 'one' instead of 'on', is that: 'one' will only listen for the event once and then unbind itself