这是我的 textareainput 代码,它只接受字符而不是数字。
var harfInput1 = document.getElementById('graduated_university_country');
harfInput1.addEventListener("keyup",function(){
if (harfInput1.value.match(/[^a-zA-Z' ']/g)){
harfInput1.value = this.value.replace(/[^a-zA-Z]/g,'');
}
})
问题是我不能接受这样的土耳其语字符。我尝试在下面添加代码,但它不起作用。
var harfInput1 = document.getElementById('graduated_university_country');
harfInput1.addEventListener("keyup",function(){
if (harfInput1.value.match(/[^a-zA-Z' '][^\wığüşöçĞÜŞÖÇİ]/g)){
harfInput1.value = this.value.replace(/[^a-zA-Z][^\wığüşöçĞÜŞÖÇİ]/g,'');
}
})
有什么建议么?