I have this code that removes any Numeric values from an input field.
This works fine but the issue is that it will also remove the Spaces too which is not wanted.
This is my code:
$(document).on('keyup','.myclassname', function(e){
var regexp = /[^a-zA-Z]/g;
if($(this).val().match(regexp)){
$(this).val( $(this).val().replace(regexp,'') );
}
});
Can someone please advice on this?
/[^a-zA-Z]/gis any character that's no in the alphabet, including whitespace and punctuation (and numbers, which you want).