Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

jQuery :enabled Selector

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article

The jQuery :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: 

HTML




<!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>

Output: 

 

Example 2: 

HTML




<!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>

Output:

 


My Personal Notes arrow_drop_up
Last Updated : 14 Nov, 2022
Like Article
Save Article
Similar Reads
Related Tutorials