Skip to content

Commit

Permalink
Update script1.js
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-bhaumik authored Jun 27, 2024
1 parent 44706fe commit ff13dc0
Showing 1 changed file with 28 additions and 2 deletions.
30 changes: 28 additions & 2 deletions Login/script1.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ document.addEventListener('DOMContentLoaded', function() {
const registerBtn = document.getElementById('register');
const loginBtn = document.getElementById('login');

const createPasswordInput = document.querySelector('.sign-up input[type="password"]');
const createPasswordInput = document.getElementById('passwordSignUp');
const createPasswordToggle = document.querySelector('.sign-up .password-toggle');

const signInPasswordInput = document.querySelector('.sign-in input[type="password"]');
const signInPasswordInput = document.getElementById('passwordSignIn');
const signInPasswordToggle = document.querySelector('.sign-in .password-toggle');

registerBtn.addEventListener('click', () => {
Expand Down Expand Up @@ -59,3 +59,29 @@ document.addEventListener('DOMContentLoaded', function() {
toggleSignInPasswordVisibility();
});
});

document.addEventListener('DOMContentLoaded', function() {
const signInForm = document.querySelector('.form-container.sign-in form');
const signUpForm = document.querySelector('.form-container.sign-up form');

signInForm.addEventListener('submit', function(event) {
const email = signInForm.querySelector('input[type="email"]').value;
const password = signInForm.querySelector('input[type="password"]').value;

if (!email || !password) {
event.preventDefault();
alert('Required fields were not filled.');
}
});

signUpForm.addEventListener('submit', function(event) {
const name = signUpForm.querySelector('input[type="text"]').value;
const email = signUpForm.querySelector('input[type="email"]').value;
const password = signUpForm.querySelector('input[type="password"]').value;

if (!name || !email || !password) {
event.preventDefault();
alert('Required fields were not filled.');
}
});
});

0 comments on commit ff13dc0

Please sign in to comment.