JQuery Selector password

From CoderLearner
Jump to: navigation, search

Description

Select elements of type password

Syntax

$('input:password')

Note

For better performance use $('input[type="password"]')

Example 1

<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>
 
      <script>
         $().ready(function() {
            $('input:password').css('border','3px solid red');
         });
      </script>
   </head>
   <body> 
      <form>
         <table>
            <tr>
               <td class="lb">Email Login :</td>
               <td>
                  <input type="text" name="uname" value="" class="required"/>
               </td>
            </tr>
            <tr>
               <td class="lb">Password :</td>
               <td>
                  <input type="password" name="pwd" value="" class="required"/>
               </td>
            </tr>

            <tr><td></td><td><input type="submit" value="Login" /></td></tr>
         </table>
      </form>
   </body>
</html>

Try It