-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Input condition is wrong #1
Comments
The problem is the boolean values are inverse, we need to fix it by changing it function validateInput() {
var username = document.getElementById('username').value;
var regex = /^[a-zA-Z0-9]+$/;
if (!regex.test(username)) {
alert('Invalid username. Only alphanumeric characters are allowed.');
return true;
}
return false;
} To function validateInput() {
var username = document.getElementById('username').value;
var regex = /^[a-zA-Z0-9]+$/;
if (!regex.test(username)) {
alert('Invalid username. Only alphanumeric characters are allowed.');
return 0;
}
return 1;
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
No description provided.
The text was updated successfully, but these errors were encountered: