I am new to JavaScript. I have created a form which submits details to a database. I have different textboxes, some need to accept Only Letters and some to allow only numbers.
I got this code while doing some research, but this code tells me of an invalid pattern. Can you help me so that this code will allows Only Letters. I tried to modify the code so that it takes only letters but I failed.
function f_check_Lett(form){ //Only letters and numbers allowed
var text = form.bucketname.value;
alert(text);
var filter = /^[A-Za-z0-9]+$/;
if (filter.test(text)) {
form.submit();
} else {
form.bucketname.select();
alert("Only Allow letters and numbers!");
}
}