테스트 사이트 - 개발 중인 베타 버전입니다

event.isPropagationStopped ()

· 8년 전 · 1669

event.isPropagationStopped ()


설명 : 이 이벤트 객체에서 event.stopPropagation () 이 호출 되었는지 여부를 반환합니다 .


예:

event.stopPropagation ()가 불려 갔는지 여부를 확인합니다.


<!doctype html>

<html lang="en">

<head>

  <meta charset="utf-8">

  <title>event.isPropagationStopped demo</title>

  <script src="https://code.jquery.com/jquery-1.10.2.js"></script>

</head>

<body>

 

<button>click me</button>

<div id="stop-log"></div>

 

<script>

function propStopped( event ) {

  var msg = "";

  if ( event.isPropagationStopped() ) {

    msg = "called";

  } else {

    msg = "not called";

  }

  $( "#stop-log" ).append( "<div>" + msg + "</div>" );

}

 

$( "button" ).click(function(event) {

  propStopped( event );

  event.stopPropagation();

  propStopped( event );

});

</script>

 

</body>

</html>

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기

게시글 목록

번호 제목
15895
15894
15893
15888
15887
15886
15885
jQuery .end()
15884
15883
jQuery .each()
15882
jQuery .die ()
15881
15880
15878
15877
15876
15874
15873
15872
15871
15866
15865
15864
15863
15862
15861
15859
15858
15857
15856
15855