jQuery | :enabled Selector

The :enabled selector is used to select all enabled form elements.

Syntax :

$(":enabled")

Parameter:



  • :enabled selector : It is used for selecting HTML elements that support the disabled attribute. i.e button tag, input tag, optgroup tag, option tag, select tag, and textarea tag .

Example-1:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>:enabled Selector</title>
    <script src=
  </script>
    
    <script>
        $(document).ready(function() {
         $(":enabled").css("background-color",
                              "green");
        });
    </script>
</head>
  
<body>
    <center>
        <form action="#">
            <h1>Welcome to GeeksforGeeks!.</h1>
            <div>
                Text :
                <input type="text"
                       name="text"
                       value="GeeksforGeeks">
                <br/>
                <input type="submit" 
                       name="submit" 
                       value="submit">
            </div>
  
        </form>
    </center>
  
</body>
  
</html>

chevron_right


Output:

Example-2:

filter_none

edit
close

play_arrow

link
brightness_4
code

<!DOCTYPE html>
<html>
  
<head>
    <title>:enabled Selector</title>
    <script src=
  </script>
    
    <script>
        $(document).ready(function() {
            $(":enabled").css("background-color",
                              "green");
        });
    </script>
</head>
  
<body>
    <center>
        <form action="#">
            <h1>Welcome to GeeksforGeeks!.</h1>
            <div>
                Select :
                <select>
                    <option>1</option>
                    <option>2</option>
                    <option>3</option>
                    <option>4</option>
                </select>
            </div>
  
        </form>
    </center>
  
</body>
  
</html>

chevron_right


Output



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.