Hi I'm practicing JS and I have a question from javascript.
I'm gonna make the user to type only letters and if the user decides to type numbers too, the program stop him/her. and please no jQuery Answers cuz I don't know anything about it yet.
here's my code......
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<script type="text/javascript">
function vent (t)
{
var m=/^[a-zA-Z]+$/
t=document.getElementById("txt");
if(t.value.match(m))
{
alert("Co");
return true;
}
else
{
// I want to write my preventing code here.......
}
}
</script>
</head>
<body>
<input type="text" id="txt" onBlur="vent (this)"/><br/>
<input type="text"/>
</body>
</html>