Created
April 3, 2018 12:45
-
-
Save oops-wrong/ecaedb8ef5f6119ed81fac7bf83db9cc to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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