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>
<head>
<title>:enabled Selectortitle>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
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>
<head>
<title>:enabled Selectortitle>
<script src=
"https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js">
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>1option>
<option>2option>
<option>3option>
<option>4option>
select>
div>
form>
center>
body>
html>
Output: 