I have looked at many Posts regarding setInterval
and none of them have the answer I am looking for or what I am trying to achieve what I want.
I am looking for one setInterval
function with 2 clicks. The first click is separated by 2sec from the 2nd click. It only runs once What I have at the moment is a workaround using two functions, it works.. but I would rather have them in one function rather than two functions.
The first click is immediate runs in one seconds (1000)it closes the open modal. Then the next click is after 2 seconds(2000) it removes a clone. Below is what I am using at the moment with in my $each
. Thanks for your help.
$.each(deleteCard, function( i, person ) {
setTimeout(function() {
$("#"+person.id).find('.close-modal').click();
}, 1000);
setTimeout(function() {
$("#"+person.id).find('.card').remove();
}, 2000);
});