• How To?
  • Tips ‘n Tricks
  • WordPress
  • Snippets
  • Software
    • Browsers
    • Downloads
  • Web
  • Tools
    • Character Counter
    • chmod Calculator
    • Entities Encoder
    • Live HTML Editor
    • My IP
  • Contact
Twitter Facebook Google+ RSS
You are here: SumTips » Snippets » JavaScript Snippets » Show-Hide Password in a Field

Show-Hide Password in a Field

Posted on November 13, 2011 by Renji | Short URL: http://sumtips.com/?p=5904

By using jQuery, you can easily transform a password field to a text field and allow your users to view password they typed in a field.

Code:

<label>Password:</label>
<input type="password" id="password" name="pass"/>
<a href="javascript:void(0);" class="show-hide-pass" onclick="document.getElementById('password').type='text';$('.show-hide-pass').toggle();">Show Password</a>
<a href="javascript:void(0);" style="display:none;" class="show-hide-pass" onclick="document.getElementById('password').type='password';$('.show-hide-pass').toggle();">Hide Password</a>

View: Demo


Tweet

Related posts:

  • Add Option to Hide/Show Comments on Google+ Posts with +Comment Toggle
  • Password Protect Firefox Bookmarks with Link Password
  • Create a Strong Password and Sally will Bare it All for You
  • Embed Google’s Pac Man Game on Your Website
  • Hide the Notification Area Icons in Windows
Categories: JavaScript Snippets
Smooth Scroll to Page Top without an Anchor
Enable Tab in HTML textarea Tag – JavaScript, jQuery & MooTools

  • Get Updates via Email

  • Recent Posts

    • CMS2CMS: Migrate Site from Drupal or Joomla to WordPress
    • WordPress: Add Preview Button in Distraction Free Writing
    • How to Activate or Deactivate Individual Jetpack Modules
    • Windows 8: Auto Update Defender with Windows Update Disabled
    • Automatically Start and Close Programs at Specific Time
    • How to Copy Code from Notepad++ with Syntax Highlighting
  • Random Posts

    • Get Compact Layout in New Google Reader
    • Set Any Image As A Wallpaper From Google Chrome
    • Delete Individual or All Facebook Messages in a Single Click
    • Restore Opened Folders/Tabs Automatically on Restart of Windows/Firefox
    • Create Interactive Image Maps with Thinglink
    • Get Google Voice on Your Desktop with GVNotifier
  • Categories

    • Blogging
    • Games
    • Google
    • How To?
    • Linux
    • Microsoft
      • Windows
    • Miscellaneous
    • Phone
    • Snippets
      • AutoHotkey Snippets
      • CSS Snippets
      • htaccess Snippets
      • JavaScript Snippets
      • PowerShell Snippets
      • WordPress Snippets
    • Social
    • Software
      • Browsers
    • Tips 'n Tricks
    • Wallpapers
    • Web
© SumTips. Contact | Sitemap | Privacy Policy