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">
							<button type="submit" class="btn btn-danger" name="button">Call me back</button>

2 Answers 2

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

    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <script src="jquery.mask.js"></script>
    <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');
What if you set the default value and prohibit erasing the first 4 characters?

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

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