'How to repeat animations on inputs

I have the same problem as this one, but my animation gets triggered by a function called with an onclick function and the method element.style.animation. How can I make it run every time it gets triggered?

            if (tickets < 1 || tickets == '' || tickets%1 != 0){
                let alert = document.getElementById('alert-id');
                alert.style.animation = 'errorSlidein 6s forwards';
            }

Thank you!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source