Welcome aboard! We are happy you are here and wish you good net-raft!
<!DOCTYPE HTML>
<html>
<head>
</head>
<body>
Text: <input type="text" id="txtName"/>
<br/>
<br/>
<input type="button" value="Submit" onclick="Validate()"/>
<script type="text/javascript">
function Validate() {
var regex = /^[A-Za-z0-9]+$/
var isValid = regex.test(document.getElementById("txtName").value);
if (!isValid) {
alert("Only Alphabets and Numbers allowed.");
}
else
{
alert("It's ok!");
}
}
</script>
</body>
</html>
The most helpful JAVASCRIPT solutions
How can I get the last day and the next day in javascript ?JAVASCRIPT Click to see more ... 5.8K 507