Skip to content
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

hello.html, hello.js, hello.css 파일 추가 #13

Merged
merged 1 commit into from
May 24, 2022
Merged
Show file tree
Hide file tree
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
7 changes: 7 additions & 0 deletions hello.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
.hidden {
display : none;
}

body {
background-color: beige;
}
18 changes: 18 additions & 0 deletions hello.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel = "stylesheet" href = "hello.css">
<title>hello</title>
</head>
<body>
<form id = "login-form">
<input required maxlength="15" type="text" placeholder="What is your name?">
<button>Log In</button>
</form>
<h1 id = "hello"></h1>
<script src = "hello.js"></script>
</body>
</html>
13 changes: 13 additions & 0 deletions hello.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
const loginForm = document.querySelector("#login-form");
const loginInput = document.querySelector("#login-form input");
const hello = document.querySelector("#hello");

function loginSB(event) {
event.preventDefault();
loginForm.classList.add("hidden");
const userName = loginInput.value;
hello.innerText = `Nice to meet you, ${userName} !`;
hello.classList.remove("hidden");
}

loginForm.addEventListener("submit", loginSB);