Open In App

How to find all input elements that are enabled using jQuery?

Last Updated : 13 Apr, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

The jQuery " :enabled" pseudo-class selector helps to find all the input element that are enabled. This pseudo-class selector should only be used for selecting HTML elements that support the disabled attribute i.e (<button>, <input>, <textarea>, <select>, <option>, <optgroup>)

As with other pseudo-class selector like (a:hover) is also recommended preceding it with a tag name or with some other selector, otherwise the universal selector ("*") is implied like $( "*:enabled" ) or $( "input:enabled").

Syntax:

$( "input:enabled" ).val( "This box is enabled" );

Note: (:enabled) select elements that have their boolean disabled property strictly to false. 

HTML code: The following code demonstrates the :enabled pseudo-class selector to find all the input elements that are enabled using jQuery.

Output:

Enabled

Next Article

Similar Reads