I want to write a code for not allowing to take special character or whitespace as input.
eg:- TN03UB8192
this is the required input. If i input as: TN03U* it woun=ld not take * as input. Instead of taking it as input need to halt or take next allowed character as input.
Now i have a code this is working but will show alert only after 10 key press. Please help me
function alphanumeric(inputtxt)
{
var letters = /[A-Z]{2}[0-9]{2}[A-Z]{2}[0-9]{4}$/;
if(inputtxt.value.match(letters))
{
alert('Your registration number have accepted : you can try another');
document.form1.text1.focus();
return true;
}
else
{
alert('Please input in correct format');
return false;
}
}