// Run the script when the DOM is fully loaded
document.addEventListener('DOMContentLoaded', function () {
// Select all input fields of type 'tel'
const numberInputs = document.querySelectorAll('input[type="tel"]');
// Remove non-digit characters from the input
numberInputs.forEach(function(input) {
input.addEventListener('input', function() {
// Replace anything that is not a digit with an empty string
this.value = this.value.replace(/\D/g, '');
});
});
// Limit the number of digits to 15
numberInputs.forEach(function(input) {
input.addEventListener('input', function() {
// Trim the value to 15 digits if it exceeds the limit
if (this.value.length > 15) {
this.value = this.value.slice(0, 15);
}
});
});
});