Hi
How to validatethat textbox should accept only alphabets using javascript.
Textbox Name : txtcode
Thanks
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jiteendra SampathiraoPosted Jul 19, 2011, 9:06 AM
function validate()
{
var good = false;
var chk_name=/^[A-Za-z ]$/;
if(document.form1.ENAME.value == "")
{
window.alert("ENAME field should not be blank");
document.form1.ENAME.focus();
}
else
{
if (!ck_name.test(document.form1.ENAME.value))
{
window.alert("The Ename Field cannot contain special characters");
document.form1.ENAME.value="";
document.form1.ENAME.focus();
}
}
return (good);
}
hope this help you.......
Benjamin KemnerPosted Jul 19, 2011, 9:00 AM