Skip to content
Related Articles

Related Articles

Save Article
Improve Article
Save Article
Like Article

jQuery | :password Selector

  • Last Updated : 22 Feb, 2019

The :password Selector is used to select the input element having password field . i.e (type==password)

Syntax:

$(":password")

Example:




<!DOCTYPE html>
<html>
  
<head>
    <script src=
  </script>
    
  <script>
      $(document).ready(function() {
         $(":password").css("background-color", 
                               "green");
        });
    </script>
</head>
  
<body>
    <center>
        <h1 style="color:green;">
          GeeksForGeeks
      </h1>
        <h2>jQuery :password Selector
      </h2>
  
        <form action="">
            Name:
            <input type="text"
                   name="user">
            <br> Password:
            <input type="password" 
                   name="password">
            <br>
            <br>
            <input type="reset" 
                   value="Reset">
            <input type="submit"
                   value="Submit">
            <br>
        </form>
  
</body>
  
</html>

Output:

Supported Browsers: The browser supported by jQuery :password Selector are listed below:

  • Google Chrome
  • Internet Explorer
  • Firefox
  • Opera
  • Safari



My Personal Notes arrow_drop_up
Recommended Articles
Page :