JavaScript jQuery - Multiple click events jquery multiple click events,jquery multiple click handlers,jquery multiple

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" target='_blank' 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>
Answer:1

You need to remove the CSS class once the animation is over.

$('h1').click(function() {
  $(this).addClass('animated bounce').one('webkitAnimationEnd mozAnimationEnd MSAnimationEnd oanimationend animationend', function() {
    $(this).removeClass();
  });
});
<link rel="stylesheet" target='_blank' 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>

<h1>Testing</h1>
Answer:2

const map = {} for (let i=0;i<10**5;i++) { map[i] = true } let ans = 0 for (let i in map) { for (let j in map) { ans += i+j } } console.log(ans) The above code when run ...

const map = {} for (let i=0;i<10**5;i++) { map[i] = true } let ans = 0 for (let i in map) { for (let j in map) { ans += i+j } } console.log(ans) The above code when run ...

  1. javascript heap memory error
  2. javascript heap memory increase
  3. javascript heap memory limit
  4. javascript heap memory
  5. js heap memory
  6. js heap memory leak
  7. javascript memory heap stack
  8. javascript memory heap code
  9. clear javascript heap memory
  10. javascript heap out memory
  11. javascript memory heap size
  12. javascript heap out of memory
  13. firefox javascript heap memory disclosure vulnerability
  14. node js heap memory usage
  15. node js heap memory
  16. javascript heap out of memory npm
  17. javascript heap out of memory webpack
  18. javascript heap out of memory node
  19. javascript heap out of memory npm build
  20. javascript heap out of memory angular 7

I'm using RSpec + capybara, and the capybara-webkit as driver. I have to check if a JS box exists in the page after clicking on a button, but with no results. If I use selenium as a driver, the test ...

I'm using RSpec + capybara, and the capybara-webkit as driver. I have to check if a JS box exists in the page after clicking on a button, but with no results. If I use selenium as a driver, the test ...

  1. check exists in sql
  2. check file exists with javascript
  3. check if file exists with python
  4. check if file exists with wildcard bash
  5. check if file exists with powershell
  6. check if element exists with jquery
  7. check if file exists with curl
  8. check if file exists with javascript
  9. check if file exists with bash
  10. check if service exists with ansible
  11. check if file exists with ifstream
  12. check if class exists with jquery
  13. check if file exists with vba
  14. check if file exists with wget
  15. check if file exists with php
  16. check if row exists with mysql
  17. check if user exists with ansible
  18. check if directory exists with powershell
  19. check if folder exists with powershell

I have a div in which I have a button and a textarea. What is the easiest way to get my hands on a child from a given div by its id? <html> <head> <link rel="stylesheet" ...

I have a div in which I have a button and a textarea. What is the easiest way to get my hands on a child from a given div by its id? <html> <head> <link rel="stylesheet" ...

  1. element same line css
  2. element same id html
  3. element same number of protons and neutrons
  4. element same
  5. element same atom
  6. element same as molecule

I'm using Template.uploadFile.events({ 'change .set-file': function ( event, template ) { var file = event.currentTarget.files[0]; [...] } }); when uploading a file. I want to read ...

I'm using Template.uploadFile.events({ 'change .set-file': function ( event, template ) { var file = event.currentTarget.files[0]; [...] } }); when uploading a file. I want to read ...

  1. shiny update reactive variable
  2. r shiny update reactive variable
  3. shiny update reactive values