Skip to content

The Login button is functional #2

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
99 changes: 53 additions & 46 deletions Glassmorphism Login Form/index.html
Original file line number Diff line number Diff line change
@@ -1,52 +1,59 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Glassmorphism Login Form</title>
<link rel="stylesheet" href="style.css">
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
<title>Glassmorphism Login Form</title>
<link rel="stylesheet" href="style.css" />
</head>

<body>

<div class="login-wrapper">

<form action="#">

<h2>Login</h2>

<div class="input-field">
<input type="text" required>
<label>Enter your email</label>
</div>

<div class="input-field">
<input type="password" required>
<label>Enter your password</label>
</div>

<div class="password-options">

<label for="remember">
<input type="checkbox" id="remember">
<p>Remember me</p>
</label>

<a href="#">Forgot password</a>

</div>

<button type="submit">Log in</button>

<div class="account-options">
<p>Dont't have an account? <a href="#">Register</a></p>
</div>

</form>

</div>

<div class="login-wrapper">
<form id="loginForm" action="#">
<h2>Login</h2>

<div class="input-field">
<!-- placeholder=" " enables :placeholder-shown to detect "empty" vs "has text" -->
<input type="text" id="username" placeholder=" " required>
<label for="username">Enter your email</label>
</div>

<div class="input-field">
<input type="password" id="password" placeholder=" " required>
<label for="password">Enter your password</label>
</div>

<div class="password-options">
<label for="remember">
<input type="checkbox" id="remember">
<p>Remember me</p>
</label>
<a href="#">Forgot password</a>
</div>

<button type="submit">Log in</button>

<div class="account-options">
<p>Don't have an account? <a href="#">Register</a></p>
</div>
</form>
</div>

<script>
document.getElementById("loginForm").addEventListener("submit", function (event) {
event.preventDefault(); // prevent navigation while demoing

const username = document.getElementById("username").value.trim();
const password = document.getElementById("password").value.trim();

if (!username || !password) {
alert("Please enter your username and password.");
return;
}

// proceed (demo)
alert("Login successful!");
// For real form submission, remove event.preventDefault() or call form.submit()
});
</script>
</body>

</html>
</html>