Skip to content

Commit bcc0d32

Browse files
committed
loginfunctionality added
1 parent 37d7fa5 commit bcc0d32

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

sampleprgm.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
const form = document.querySelector('form');
2+
3+
form.addEventListener('submit', (e) => {
4+
e.preventDefault();
5+
6+
const email = document.getElementById('email').value.trim();
7+
const password = document.getElementById('password').value.trim();
8+
9+
if (!email || !password) {
10+
alert('Please fill in all fields');
11+
return;
12+
}
13+
14+
if (!email.includes('@')) {
15+
alert('Please enter a valid email');
16+
return;
17+
}
18+
19+
if (password.length < 6) {
20+
alert('Password must be at least 6 characters');
21+
return;
22+
}
23+
24+
console.log('Login submitted:', { email, password });
25+
alert('Login successful!');
26+
});

0 commit comments

Comments
 (0)