jQuery :enabled Selector

The jQuery :enabled Selector selects all the elements that are enabled in a form. By default, all the elements of a form are in an enabled state. However, when a few elements of a form is disabled. You can highlight only the enabled elements using this selector.

jQuery :enabled Selector

Syntax of the Selector

The syntax of jQuery :enabled selector is given below.

Syntax
$(“:enabled”)

You don’t have to pass any argument to the selector. However, to select a specified form, you can use the class name or id of the form. By doing this, you can select only the required form elements if there are many forms.

jQuery :enabled Selector Selects All Enabled Elements

If you want to select elements that are in an enabled state, you can this selector. There can be many elements that are not enabled. You can highlight only the enabled elements by applying the CSS.

Example

Test it Live

Output




The above example contains all the elements in the enabled form. It highlights the elements by applying the background color to the elements. You can easily identify the highlighted enabled elements above. However, all the elements are in an enabled state that’s why it selects every element.

The above example showing the enabled form elements. It’s an easy way for you to identify each elements with the yellow color.

If you have any queries regarding this tutorial post, please comment below.

Also tell me, what other methods you are using with the selector by commenting below.

References