Created
May 24, 2019 13:49
-
-
Save AlexKardone/2ca0d0e074448f5cccfece108d72a823 to your computer and use it in GitHub Desktop.
Phone field mask
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
<script> | |
$(document).ready(function() { | |
$("#phone").mask("+7 (999) 99-99-999", {autoclear: false}); | |
$("#phone").click(function(){ | |
if($("#phone").val()=="+7 (___) __-__-___") { | |
$('#phone')[0].selectionStart = 4; | |
$('#phone')[0].selectionEnd = 4; | |
} | |
}) | |
}); | |
</script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment