JQuery Selector Disabled

From CoderLearner
Jump to: navigation, search

Description

Select all elements that are disabled.

Syntax

$('input:disabled')

Example 1

<!DOCTYPE html>
<html>
   <head>
      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      <title>Select</title>
      <script 
         type="text/javascript" 
         src="/lib/jquery-1.7.2.min.js">				 
      </script>
      <style>
         .mark {
            background-color:green;
         }
      </style>
      <script>
         $().ready(function() {
            $('input:disabled').val('Disabled INPUT'); 
         });
      </script>
   </head>
   <body> 
      <form>
         <input type="text" name="first"/><br/>
         <input type="text" name="middle" disabled="disabled"/><br/>
         <input type="text" name="last"/><br/>
         <input type="text" name="age" disabled="disabled"/><br/>
         <input type="text" name="city"/><br/>
      </form>
   </body>
</html>

Try It