phonemask
Library for processing the phone input field in the web form. Only native javascript is used
Usage:
- Adding a library to HTML
<script type="application/javascript" src="src/phonemask.js"></script>
or
<script type="application/javascript" src="src/phonemask.min.js"></script>
- Adding a phone input field to HTML
<input type="text" class="form-control" id="phone" name="phone" value="+38 (0__) ___ - __ - __" mask="+38 (0__) ___ - __ - __" placeholder="+38 (0__) ___ - __ - __">
- Adding javascript code to initialize the phone input field handler by mask
<script type="text/javascript">
const cssPhone = 'input[name="phone"';
(new phoneMask()).init(cssPhone);
</script>