Swap Password field with a text with jQuery
JavaScript
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
jquery.passwordTextSwap.js
jquery.passwordTextSwap.min.js
readme.md
test.html

readme.md

Introduction

jQuery plugin to swap password field with a text field. The text field on focus will hide and the focus is transfered to the now visible password field. The password field will be swapped back to the text field if left empty.

Example:

<!DOCTYPE HTML>
<html lang="en-US">
<head>
  <meta charset="UTF-8">
  <title>jquery.passwordTextSwap</title>
</head>
<body>
  <form action=""><input type="password" id="password" /><input type="submit" /></form>
  <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>
  <script type="text/javascript" src="jquery.passwordTextSwap.js"></script>
  <script type="text/javascript">
    jQuery('#password').passwordTextSwap().prev('input:text').val('I am replaced');
  </script>
</body>
</html>

see also