I'm using this plugin to validate my form.
On my form, I have a password input and a 'show password' checkbox. When the user clicks on show password, the input changes from password type to text.
$('#show_password').off();
$('#show_password').on('click', function() {
var change = '';
var $input = $('#cpassword');
if ($(this).is(':checked')) {
change = 'text';
} else {
change = 'password';
}
var rep = $('<input type="' + change + '" />')
.attr('id', $input.attr('id'))
.attr('name', $input.attr('name'))
.attr('class', $input.attr('class'))
.val($input.val())
.insertBefore($input);
$input.remove();
$input = rep;
$('#frm_user_details').formValidation('revalidateField', 'password');
});
so basically the input type changed (but keeps the same name) and I need to revalidate the field but it's not working.