document.oninput = function(e) { if ( e.target.classList.contains('search-input') ) { e.target.value = e.target.value.replace(/[^\d()-]/g, ''); } };