:enabled Selector - Javascript jQuery Selector

Javascript examples for jQuery Selector:enabled

Description

The :enabled selector selects all enabled form elements.

The following code shows how to select all the enabled form elements:

Demo Code

ResultView the demo in separate window

 
 <!DOCTYPE html>
 <html>
 <head>
 <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
 <script>
 $(document).ready(function(){
     $(":enabled").css("background-color","blue");
 });/*w w  w  .j ava2 s  .  c  om*/
 </script>
 </head>
 <body>
     
 <form action="">
 Name: <input type="text" name="user"><br>
 ID:<input type="text" name="id" disabled="disabled">
 new ID:<input type="text" name="id">
 Age:
 <select disabled="disabled">
   <option>20-30</option>
   <option>30-50</option>
   <option>50+</option>
 </select>
     
 <select>
   <option>20-30</option>
   <option>30-50</option>
   <option>50+</option>
 </select>
     
     
 <input type="submit">
 </form>
     
 </body>
 </html>

Related Tutorials