You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The problem is the boolean values are inverse, we need to fix it by changing it return true to return 0 and vice versa return false to return 1
functionvalidateInput(){varusername=document.getElementById('username').value;varregex=/^[a-zA-Z0-9]+$/;if(!regex.test(username)){alert('Invalid username. Only alphanumeric characters are allowed.');returntrue;}returnfalse;}
To
functionvalidateInput(){varusername=document.getElementById('username').value;varregex=/^[a-zA-Z0-9]+$/;if(!regex.test(username)){alert('Invalid username. Only alphanumeric characters are allowed.');return0;}return1;}
No description provided.
The text was updated successfully, but these errors were encountered: