28 lines
768 B
JavaScript
28 lines
768 B
JavaScript
const email = document.getElementById('email');
|
|
const password = document.getElementById('password');
|
|
const password2 = document.getElementById('password2');
|
|
password2.addEventListener('change', checkPassword);
|
|
|
|
|
|
|
|
function register() {
|
|
if (!checkPassword()) {
|
|
return;
|
|
}
|
|
const form = document.querySelector('#marmeladenLadenRegisterForm');
|
|
var formData = new FormData(form);
|
|
const jSONdata = JSON.stringify(Object.fromEntries(formData));
|
|
|
|
//print elements of jSONdata
|
|
console.log(jSONdata);
|
|
}
|
|
|
|
function checkPassword() {
|
|
if (password.value != password2.value) {
|
|
password2.setCustomValidity('Passwords do not match');
|
|
return false;
|
|
} else {
|
|
password2.setCustomValidity('');
|
|
return true;
|
|
}
|
|
} |