Home >>jQuery Tutorial >jQuery Password Selector

jQuery Password Selector

jQuery Password Selector

jQuery password selector in jQuery is used to selects input elements with type=password.

Syntax:

$(":password")

Here is an Example of jQuery :password Selector


<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$(":password").css("background-color", "#c0ed1f");
});
</script>
</head>
<body>
<form action="">
Name: <input type="text" name="user"><br>
Password: <input type="password" name="password"><br>
<button type="button">Button</button>
</form>
</body>
</html>

Output:
Name:
Password:

No Sidebar ads