Form Enabled form element (input:enabled)

Description and Syntax

$(":enabled")

selects all form elements that are enabled

Examples

The following code counts the enabled form element.


<html>
  <head>
    <script src="http://java2s.com/style/jquery-1.8.0.min.js"></script>
    <script type="text/javascript">
        $(document).ready(function(){<!--   w ww  .j  a  va 2 s. c  om-->
            alert($("input:enabled").length);
        });
    </script>
  </head>
  <body>
    <body>
    <form>
        <input type="button" value="Input Button" disabled="disabled"/>
    
        <input type="checkbox">java2s.com</input>
        <input type="checkbox" />
        <input type="checkbox" />
        <input type="file" />
        <input type="hidden" />
        <input type="image" />
        <input type="password" />
        <input type="radio" />
        <input type="reset" />
        <input type="submit" />
        <input type="text" />
    
        <select><option>Option<option/></select>
        <textarea></textarea>
        <button>Button</button>
    </form>    
    </body>
</html>

Click to view the demo

The code above generates the following result.

Form Enabled form element (input:enabled)