Files
web-chat/frontend/js/signup.js
2024-08-25 18:09:59 +02:00

29 lines
763 B
JavaScript

window.onload = () => {
document.getElementById('username').focus();
}
function showPasswd() {
let x = document.getElementById("password");
let y = document.getElementById("sPassword");
if(x.type == "password"){
x.type = "text";
y.type = "text";
} else {
x.type = "password";
y.type = "password";
}
}
document.getElementById('signupForm').addEventListener('submit',async function (event) {
event.preventDefault();
const password = document.getElementById("password").value;
const sPassword = document.getElementById("sPassword").value;
console.log(password, sPassword);
if(password !== sPassword){
alert("Passwords don't match!");
} else {
this.submit();
}
})