Created
March 11, 2019 06:07
-
-
Save vijjusri14/280171cc0c58a785cf9791e2385ad6ed to your computer and use it in GitHub Desktop.
Set input field type as password on focus out using Jquery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <!DOCTYPE html> | |
| <html> | |
| <head> | |
| <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script> | |
| </head> | |
| <body> | |
| <h2>Jquery Text2Pass</h2> | |
| <input type="text" id="text2Pass" /> | |
| <script> | |
| $(document).ready(function() { | |
| $('#text2Pass') | |
| .on('blur', function() { | |
| this.type = 'password'; | |
| }) | |
| .on('focus', function() { | |
| this.type = 'text'; | |
| }); | |
| }); | |
| </script> | |
| </body> | |
| </html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment