JS Code SnippetOn the page you want this to appear, add an HTML widget (FREE) and paste the code in there. Be sure to have < script> before your code and after the code if it isn't already inserted above.
Instructions
(xxx) xxx-xxxx
document.addEventListener('DOMContentLoaded', function() { var phoneInputs = document.querySelectorAll('input[type="tel"]'); phoneInputs.forEach(function(input) { input.addEventListener('input', function(e) { var input = e.target.value.replace(/\D/g, ''); // Remove all non-numeric characters var formattedInput = '';
JS Code SnippetOn the page you want this to appear, add an HTML widget (FREE) and paste the code in there. Be sure to have < script> before your code and after the code if it isn't already inserted above.
Instructions
xxx-xxx-xxxx
document.addEventListener('DOMContentLoaded', function() { var phoneInputs = document.querySelectorAll('input[type="tel"]'); phoneInputs.forEach(function(input) { input.addEventListener('input', function(e) { var input = e.target.value.replace(/\D/g, ''); // Remove all non-numeric characters var formattedInput = '';
JS Code SnippetOn the page you want this to appear, add an HTML widget (FREE) and paste the code in there. Be sure to have < script> before your code and after the code if it isn't already inserted above.
Instructions
EU Format, Assuming the first two digits are the country code +xx
document.addEventListener('DOMContentLoaded', function() { var phoneInputs = document.querySelectorAll('input[type="tel"]'); phoneInputs.forEach(function(input) { input.addEventListener('input', function(e) { var input = e.target.value.replace(/\D/g, ''); // Remove all non-numeric characters var formattedInput = '';
// Assuming the first two digits are the country code +xx if(input.length > 0) { formattedInput += '+' + input.substring(0, 2); } if(input.length > 2) { formattedInput += ' ' + input.substring(2, 5); } if(input.length > 5) { formattedInput += ' ' + input.substring(5, 9); } if(input.length > 9) { formattedInput += ' ' + input.substring(9, 13); }