I made a regular expression that only accepts letters. I’m not really good in regex, thats why I don’t know how to include spaces in my regex.
My HTML:
<input id="input" />
My js / jQuery code:
$('#input').on('keyup', function() {
var RegExpression = /^[a-zA-Z]*$/;
if (RegExpression.test($('#input').val())) {
}
else {
$('#input').val("");
}
});
use this expression
Update: 27-April-2023