Download
Demo
- Overview
- Documents
User Rating: 0/5 ( 0 votes)
Your Rating:
Bootstrap Show Password is a Show/hide password plugin for bootstrap. This plugin support bootstrap v2 and bootstrap v3.
Source: github.com
1. INCLUDE CSS AND JS FILES
<link rel="stylesheet" href="assets/bootstrap-v3/css/bootstrap.css" /> <script src="assets/jquery.min.js"></script> <script src="assets/bootstrap-v3/js/bootstrap.js"></script> <script src="password.js"></script>
2. HTML
<p><input id="password" class="form-control" type="password" value="123" placeholder="password" /></p> <p><label><input id="methods" type="checkbox"/> Show password</label></p>
3. JAVASCRIPT
$(function() {
$('#password').password().on('show.bs.password', function(e) {
$('#eventLog').text('On show event');
$('#methods').prop('checked', true);
}).on('hide.bs.password', function(e) {
$('#eventLog').text('On hide event');
$('#methods').prop('checked', false);
});
$('#methods').click(function() {
$('#password').password('toggle');
});
});
4. OPTIONS
Options can be passed via data attributes or JavaScript. For data attributes, append the option name to data-, as in data-message="Show/hide password".
| Name | type | default | description |
|---|---|---|---|
| message | string | Click here show/hide password | The tooltip of show/hide icon. |
| white | boolean | false | Show the white icon.(Just work in bootstrap v2) |
5. METHODS
.password('show')
Manually show the password.
$('#password).password('show');
Manually hide the password.
$('#password).password('hide');
Manually toggle the password.
$('#password).password('toggle');
6. EVENTS
The plugin exposes a few events.
| Event Type | Description |
|---|---|
| show.bs.password | This event fires immediately when the show instance method is called. If caused by a click, the clicked element is available as the relatedTarget property of the event. |
| hide.bs.password | This event is fired immediately when the hide instance method has been called. |
$('#password).on('show.bs.password', function (e) {
});
JS Tutorial
