jQuery :animated Selector

When you want to select all the animated elements on a single page, you have to use the jQuery :animated selector. It selects the current animation running elements to apply jQuery effects.

Let’s see the syntax to find out how to use the selector.


The above syntax selects all the currently animating elements. If you want to select all the animating elements for the specified tag name. jQuery :animated Selector comes with another syntax given below.


So, let’s start with a simple example contains three div elements. The first div element is animated and the other two remain without any animation.

The animation effect first increases the width, height, and margin. It then reverts back to its initial state condition again. You have to now apply the background property of CSS using jQuery to the animated element.


Test it Live


When you click the above button, it selects only the animating element.

Now, click the button given in the example above to select the animated element. It changes the color of the animated element on button click. You can apply many effects only to the animated element using this selector.

The above example selects all the elements of the page. But, if you want to select only the specified element on a given page, you have to use the second syntax given above.

Let’s take an example to select only animation running with the div element. You have to use it as $(“div:animated”) with the jQuery effect to apply to the animated element.