username validation in javascript
function validateUserName(username){
var usernameRegex = /^[a-zA-Z0-9]+$/;
return usernameRegex.test(username);
}
username validation in javascript
function validateUserName(username){
var usernameRegex = /^[a-zA-Z0-9]+$/;
return usernameRegex.test(username);
}
username validation js
<!DOCTYPE html>
<html>
<head>
<title></title>
</head>
<body>
<form method="post" action="">
username:<input type="text" id="name" onkeyup="validation()">
</form>
</body>
<script type="text/javascript">
function validation(){
var username=document.getElementById("name").value;///get id with value
var usernamepattern=/^[A-Za-z .]{3,15}$/;////Regular expression
if(usernamepattern.test(username))
{
document.getElementById("name").style.backgroundColor='yellow';
}
else
{
document.getElementById("name").style.backgroundColor='red'; }
}
</script>
</html>
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us