I have a problem. I just started learning jQuery, my first experience with javascript at all. And I want to make an element animate on click, and I did make that work:
HTML:
<h1>Testing</h1>
I'm using Animate.css to make some animations happen on click. Here's my jQuery:
$('h1').click(function (e) {
$('h1').addClass('animated bounce');
});
What I want to achieve is that when I click 2nd time, the animation happens again, in fact, I want to remove the animated bounce class and add it again, that way the animation will happen again.
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
</head>
<body>
<h1>Testing</h1>
<script>
$('h1').click(function (e) {
$('h1').addClass('animated bounce');
});
</script>
</body>
And please tell me if I'm doing the code the way it should be, I mean if the syntax is fine, I've seen codes with $(this) and I'm not sure what that is, also I've seen something like .on('click')
Thank You.