jQuery – :password Selector

The jQuery password selector selects all elements of type password.

Source Code

<!DOCTYPE html>
<html>
<head>
  <script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<div class="div1">
<label>Password : </label><input type="password" />
</div>
<button>Click Here</button>

  
<script>
jQuery("button").click(function () {
	jQuery("div.div1 > :password").css({border:"3px #1E8CBE solid"});
});
</script>
</body>
</html>

Demo

Following example finds all password inputs and create a border.

,

No comments yet.

Leave a Reply