Password Visibility Toggler In Vanilla JavaScript

Category: Form , Javascript | May 11, 2020
Author: guillaumebriday
Views Total: 162 views
Official Page: Go to website
Last Update: May 11, 2020
License: MIT

Preview:

Password Visibility Toggler In Vanilla JavaScript

Description:

A Custom Element to create an SVG password visibility toggler that enables the users to reveal passwords behind asterisks on click.

How to use it:

1. Import the custom-element-password-toggle

# Yarn
$ yarn add custom-element-password-toggle

# NPM
$ npm install custom-element-password-toggle --save

2. Import the component.

<script type="module" defer>
  import 'custom-element-password-toggle'
</script>
// or from a CDN
<script type="module" defer src="https://unpkg.com/custom-element-password-toggle"></script>

3. Add the is=”password-toggle” to the password field and done.

<input type="password" is="password-toggle" />

You Might Be Interested In:


Leave a Reply