Skip to content

40장 #41

@hyunahOh

Description

@hyunahOh

헷갈리는 개념 몇 개 추렸습니다.

40.9 이벤트 헨들러 내부의 this
=> 헨들러 호출시엔 이벤트 바인딩한 돔 요소, 내부에선 window

<!DOCTYPE html>
<html>
<body>
    <button onclick="handleClick(this)">�Click me</button>
    <script>
       function handleClick(button) {
           console.log(button);//이벤트를 바인딩한 button 요소
           console.log(this);//window
       }
    </script>
</body>
</html>

40.9.2 프로퍼티 방식과 addEventListener방식
=> 헨들러 호출시, 헨들러 내부 모두 이벤트를 바인딩한 돔 요소

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions