document.getElementById('inputid').addEventListener('input', function(){ this.value = this.value.replace(/[^a-z0-9 şŞğĞüÜçÇöÖıİ]+/gi,''); });