Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save oops-wrong/ecaedb8ef5f6119ed81fac7bf83db9cc to your computer and use it in GitHub Desktop.
Save oops-wrong/ecaedb8ef5f6119ed81fac7bf83db9cc to your computer and use it in GitHub Desktop.
var $input = $('.input');
$input.inputmask({
regex: '([1-9]|10|11)',
colorMask: true
});
$input.on('blur', function (event) {
var $targetInput = $(event.target);
var pastedValue = $targetInput.val();
var isAlreadyExist = $.makeArray($(".input")).some(function(input) {
var $input = $(input);
if ($input.is($targetInput)) {
return false;
}
return $input.val() === pastedValue;
});
if (isAlreadyExist) {
$targetInput.val('');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment