Requirements:
Allows you to switch the visibility of the field by clicking on the eye icon
To load data with ajax
For readonly components
You can set event methods with parameters:
onEyeClick
: event on eye clickonShow
: before showing the valueonProtect
: before protecting valueonLoad
: before ajax loadingor by subscribing to element events:
click.adx.protected-input
: event on eye clickshow.adx.protected-input
: before showing the valueshown.adx.protected-input
: after showing the valueprotect.adx.protected-input
: before protecting valueprotected.adx.protected-input
: after protecting valueload.adx.protected-input
: before ajax loadingloaded.adx.protected-input
: after ajax loading$('.with-eye-custom').protectedInput({ onShow: function () { if (!confirm('Show this password?')) { return false; } } });
$('#psw-custom-color').on('click.adx.protected-input', function (e) { $(e.currentTarget).css('background', colors[Math.floor(Math.random()*colors.length)]); });
$('#psw-custom-question').on('show.adx.protected-input', function (e) { var answer = prompt('Type anything'); if (answer === null) { e.preventDefault(); } else { $(e.currentTarget).protectedInput('setValue', answer) } });