Skip to content

Commit

Permalink
Merge pull request #13 from Likelion-at-SMWU-10th/hw/12-6th-hw
Browse files Browse the repository at this point in the history
hello.html, hello.js, hello.css 파일 추가
  • Loading branch information
biiit4894 authored May 24, 2022
2 parents c8a52c0 + e2e0c18 commit 2bb83d9
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
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);

0 comments on commit 2bb83d9

Please sign in to comment.