How to get the jQuery MaskedInput unmask() function to work properly?

https://code.jquery.com/jquery-latest.min.js
https://igorescobar.github.io/jQuery-Mask-Plugin/js/jquery.mask.min.js
http://cloudfour.github.io/hideShowPassword/hideShowPassword.min.js

<input class="hideshowpwd cep" id="password-2" type="text" placeholder="Password" autocapitalize="off" autocomplete="off" spellcheck="true" style="margin: 0px; padding-right: 41px;">

$(document).ready(function(){
$('.cep').mask('000-00-0000');
$('.hideshowpwd').hidePassword('focus', {
toggle: { className: 'my-toggle' }
});
$('.my-toggle').click(function(){
var mask = "000-00-0000";
if($(this).hasClass('hideShowPassword-toggle-show')){
var unmaskval = $("#password-2").unmask(mask);
$('#password-2').removeClass('cep');
}else{
$("#password-2").mask(mask);
}
});
});
Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s