Reputation: 4323
I am using a jQuery plugin that provides rulesets for visually displaying the quality of a user's typed in password.
This is a JSFIDDLE to see how that plugin works.
This is working fine for me. But I have a question, when I am typing a password the visual progress bar is working. but when I paste some text to password
field its progress bar is not working.
can any body tell me, can we update this plugin to fix this issue.
I use this jQuery -
jQuery(document).ready(function () {
var options = {
onLoad: function () {
$('#messages').text('Start typing password');
},
onKeyUp: function (evt) {
$(evt.target).pwstrength("outputErrorList");
}
};
$(':password').pwstrength(options);
});
Hope somebody may help me out. Thank you.
Upvotes: 2
Views: 212
Reputation: 240938
Based on the plugin documentation, you can force an update using .pwstrength("forceUpdate")
.
Just add an event listeners for the paste
/change
events, then update the password's strength using the method.
$(':password').on('paste change', function () {
$(this).pwstrength("forceUpdate");
});
If you want to update the password's strength when programically changing the password (i.e., clearing it), all you would have to do is trigger a change event on the input element. For example:
$('#clear').on('click', function () {
$('#password').val('').change();
});
Upvotes: 3