[JavaScript] e.preventdefault() e.stoppropagation() 차이점

Yuri Lee·2022년 8월 3일
0

e.preventdefault() e.stoppropagation()

Intro

최근 새로운 e.stoppropagation() 메서드를 발견해서 e.preventdefault() 와의 차이점이 무엇인지 정리해보고자 한다.

e.preventdefault() 와 e.stoppropagation()

우선 이 두 메서드는 모두 Event 인터페이스에서 제공하는 메서드이다.

e.preventdefault()

html에서 표준으로 제공하는 태그의 기본 이벤트 발생을 막는 메서드이다.

[JavaScript] event.preventDefault() 란?

e.stoppropagation()

상위 엘리먼트로의 이벤트 전파(이벤트 버블링)을 막기 위한 메서드이다


https://ifuwanna.tistory.com/289
https://developer.mozilla.org/ko/docs/Web/API/Event

profile
Step by step goes a long way ✨

0개의 댓글