Only Allow Characters and Do Not Allow Numbers in Input Field
This technique was first used on the LPGA store's registration page.
https://www.lpgaproshop.com/account/register
The problem
The store used a plugin named customr and there were limitations on the amount of parameter control.The Solution
look for the input field and on key input limit to characters only.The Code
Add the following code and replace the input[name='customer[first_name]'] with the field that needs the code applied. This uses the let checkExists, so can simply wrap this in document.ready if the code does not need to overwrite a plugin.let checkExists = setInterval(() => {
$("input[name='customer[first_name]'], input[name='customer[last_name]']").on("input", function(){
var regexp = /[^a-zA-Z]/g;
if($(this).val().match(regexp)){
$(this).val( $(this).val().replace(regexp,'') );
}
});
clearInterval(checkExists);
});