Tuesday, 7 July 2015

simple name field validation only character allowed used javascript

<script type="text/javascript">

   function chkform(form)

   {
   



 
re =/^[a-zA-Z]+$/
if(!re.test(form.txtname.value))
{
alert("Only Character Allowed ");
form.txtname.focus();
return false;
}

</script>

<form name="f1" method="post" style="margin-left: 500px;">
<input type="text" name="txtname" placeholder="Enter Name" />
</form>

No comments:

Post a Comment