Skip to content

Commit

Permalink
#4.3 Events part Two
Browse files Browse the repository at this point in the history
  • Loading branch information
KwanHoo committed Jan 24, 2023
1 parent 1c61365 commit 1266c9f
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
2 changes: 1 addition & 1 deletion index3.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<input required maxlength="15" type="text" placeholder="What is your name?" />
<button>Log In</button>
</form>

<a href="https://moriah-blog.tistory.com/">Go to Blog</a>
<script src="script3.js"></script>
</body>

Expand Down
12 changes: 10 additions & 2 deletions script3.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
const loginForm = document.querySelector("#login-form")
const loginInput = document.querySelector("#login-form input");
// const loginButton = document.querySelector("#login-form button");

const link = document.querySelector("a");

function handleBtnClick(){
// console.dir(loginInput.value);
Expand Down Expand Up @@ -35,5 +35,13 @@ function onLoginSubmit(event){

}

function handleLinkClick(event){
console.log(event);
console.dir(event);
event.preventDefault();
alert("clicked"); //! alert은 모든 동작을 막음! (그래서 이제 아무도 사용을 하지 않음)
}

// loginButton.addEventListener("click", handleBtnClick)
loginForm.addEventListener("submit", onLoginSubmit)
loginForm.addEventListener("submit", onLoginSubmit);
link.addEventListener("click", handleLinkClick);

0 comments on commit 1266c9f

Please sign in to comment.