수

event.delegateTarget

· 2017-09-06 (수) 00:11:18 · 2336

event.delegateTarget


설명 : 현재 호출되는 jQuery 이벤트 핸들러가 연결된 요소입니다.


이 특성은 대부분 위임하여 부착 이벤트에 유용 .delegate()하거나 .on()이벤트 핸들러가 처리되고있는 요소의 상위에 부착된다. 예를 들어 위임 지점에서 이벤트 처리기를 식별하고 제거하는 데 사용할 수 있습니다.


요소에 직접 첨부 된 위임되지 않은 이벤트 핸들러의 event.delegateTarget경우 항상 동일합니다 event.currentTarget.


예:

상자 클래스의 단추를 클릭하면 상자의 배경색을 빨간색으로 바꿉니다.


$( ".box" ).on( "click", "button", function( event ) {

  $( event.delegateTarget ).css( "background-color", "red" );

});

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

개발자팁

5,403건

개발과 관련된 유용한 정보를 공유하세요. 질문은 QA에서 해주시기 바랍니다.

+
분류 제목 글쓴이 날짜 조회
jQuery
[jQuery]
17-09-09 조회 1,867
jQuery 17-09-09 조회 2,692
jQuery 17-09-09 조회 4,082
PHP 17-09-08 조회 6,138
기타 17-09-08 조회 2,422
기타 17-09-08 조회 2,245
기타 17-09-08 조회 2,538
jQuery 17-09-07 조회 2,145
jQuery 17-09-07 조회 1,856
jQuery 17-09-07 조회 2,647
jQuery 17-09-06 조회 2,337
jQuery
[jQuery]
17-09-06 조회 2,095
jQuery 17-09-06 조회 2,379
jQuery
[jQuery]
17-09-05 조회 1,784
jQuery
[jQuery]
17-09-05 조회 2,063
jQuery
[jQuery]
17-09-05 조회 1,753
jQuery
[jQuery]
17-09-02 조회 1,687
jQuery 17-09-02 조회 2,001
jQuery 17-09-02 조회 2,098
jQuery 17-09-01 조회 2,095
jQuery 17-09-01 조회 2,244
jQuery 17-09-01 조회 1,976
jQuery 17-08-31 조회 2,334
jQuery 17-08-31 조회 2,449
jQuery 17-08-31 조회 1,881
PHP 17-08-31 조회 3,300
jQuery 17-08-29 조회 1,885
jQuery 17-08-29 조회 2,070
jQuery 17-08-29 조회 2,147
jQuery 17-08-27 조회 2,012