Hello.There is a simple form: a field for entering a phone(for Ukraine) and a submit button.With the help of the pattern I set the regular expression, but not that.It is necessary that in the field when dialing the number displayed 4 characters +380.
 and then the user enters the remaining numbers?
here is the form:
<form class="form-inline" role="form" action="send-tel.php" target="_ blank" method="post" name="form">
							<div class="form-group">
								<input type="tel" class="form-control" id="tel" placeholder="000-000 -00-00"pattern="^ \ d {3} - \ d {3} - \ d {2} - \ d {2} $"name="telephone"required="required">
							</div>
							<button type="submit" class="btn btn-danger" name="button">Call me back</button>
							</form>

2 Answers 2

<input class="phone-mask" name="phone" type="text">

<html>
<head>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="jquery.mask.js"></script>
</head>
<body>
    <input class="phone-mask" name="phone" type="text">
    <script type="text/javascript">
        $.jMaskGlobals={translation: {
                'n': {pattern:/\ d /},
            }
        };
        $('.phone-mask').mask('+ 380nn-nnn-nnnn').val('+ 380');
    </script>
</body>
</html>
What if you set the default value and prohibit erasing the first 4 characters?

update:
something like this
<input id="phone" value="+ 380">

$('#phone') .on('input', function() {
  var val=this.value;
  if(val.length<4)
    this.value='+ 380';
});