如何限制用户在文本框中输入数字和特殊字符?

How can i restrict user from entering the numeric and special characters in textbox?

我希望在输入文本框时,用户无法输入特殊字符和数值。我不希望任何警报或任何跨度显示错误。我只是希望数值或特殊字符不应该显示在文本框中。我怎样才能做到这一点?提前致谢。

就这么简单

<input name="lorem" onkeyup="this.value=this.value.replace(/[^a-z]/g,'');">

onblur

也一样

如果需要,请使用 jquery:

$('#textBoxId').on('keyup blur',function(){ 
    var node = $(this);
    node.val(node.val().replace(/[^a-z]/g,'') ); }
);