Skip to content

Instantly share code, notes, and snippets.

@AlexKardone
Created May 24, 2019 13:49
Show Gist options
  • Save AlexKardone/2ca0d0e074448f5cccfece108d72a823 to your computer and use it in GitHub Desktop.
Save AlexKardone/2ca0d0e074448f5cccfece108d72a823 to your computer and use it in GitHub Desktop.
Phone field mask
<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