수

event.delegateTarget

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

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,884
jQuery 17-09-09 조회 2,731
jQuery 17-09-09 조회 4,106
PHP 17-09-08 조회 6,162
기타 17-09-08 조회 2,452
기타 17-09-08 조회 2,269
기타 17-09-08 조회 2,581
jQuery 17-09-07 조회 2,174
jQuery 17-09-07 조회 1,890
jQuery 17-09-07 조회 2,671
jQuery 17-09-06 조회 2,363
jQuery
[jQuery]
17-09-06 조회 2,133
jQuery 17-09-06 조회 2,420
jQuery
[jQuery]
17-09-05 조회 1,807
jQuery
[jQuery]
17-09-05 조회 2,094
jQuery
[jQuery]
17-09-05 조회 1,791
jQuery
[jQuery]
17-09-02 조회 1,725
jQuery 17-09-02 조회 2,031
jQuery 17-09-02 조회 2,133
jQuery 17-09-01 조회 2,129
jQuery 17-09-01 조회 2,271
jQuery 17-09-01 조회 1,998
jQuery 17-08-31 조회 2,379
jQuery 17-08-31 조회 2,484
jQuery 17-08-31 조회 1,917
PHP 17-08-31 조회 3,325
jQuery 17-08-29 조회 1,911
jQuery 17-08-29 조회 2,093
jQuery 17-08-29 조회 2,192
jQuery 17-08-27 조회 2,056