You're attempting to animate with the animate
function. Most likely, you're passing either a selector:
Or the results of a selector like getElementById
or querySelectorAll
:
Solution
To avoid this error, first use console.log
to double check that this selector returns valid elements:
If no elements are being found, then you need to first fix your selector. In the above example you'd first ensure that elements with the "item"
class actually exist.
If you're sure the selector is correct, but you're in a situation where you want to run an animation only if elements are found, then use a conditional: