Easily reveal/hide passwords in input fields.
npm install password-revealer> Easily reveal/hide passwords in input fields.
npm install password-revealer --save
`Or download the ZIP file and use it as you want.
Usage
> See basic demo (without npm) and live examples.Using npm:
`js
import PasswordRevealer from 'password-revealer' // ES2015 module syntaxPasswordRevealer('#password-field')
`$3
####
inputType:
string or HTMLElementInput field that will have its password revealed or hidden.
####
options
Type: object######
options.isRevealed
Type: boolean
Default: falseInitial state of the password. When
true, the input's password value is automatically revealed.
######
options.trigger.selector
Type: string or HTMLElement
Default: .PasswordRevealer-triggerElement that reveals or hides the password ("trigger").
######
options.trigger.eventListener
Type: string
Default: clickEvent that will be attached to the trigger, in the case you are initializing a trigger.
API
Interact with a PasswordRevealer instance using the methods below.$3
It initializes, in a element with the selector provided in options, the trigger that reveals or hides the password.$3
It reveals the password for the input provided in the instance.$3
It hides the password for the input provided in the instance.$3
It reveals or hides the password for the input provided in the instance, depending on the current state of the input.
TODO
- [ ] Emit custom events.
- [ ] Create a default trigger in the DOM when calling init()`.