password selector in jQuery with example



Password selector returns all input elements with type password.


Example :




    <html>
    <head>
    <title>password Selector</title>
    <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"> </script>
    <script type="text/javascript">
    $(document).ready(function()
    {
    $("#myButton").click(function()
    {
    $(":password").css("background-color","Orange");
    });
    });
    </script>
    </head>
    <body>
    <input type="password" id="text1" Value="This is textbox">
    <button id="myButton">Click Me</button>
    <button onclick="location.reload()">Reset</button>
    </body>
    </html>
    

Demo :





In the above example, we have used password selector. Password selector return all input elements with type password. In the above example the password selector selects the textbox of type password and changes the background color of the textbox.

0 comments:

Post a Comment