2012-07-10 3 views

답변

0

으로 jQuery를

$('a').click(function() { 
    console.log($(this)); //the event sender and can be 'a' or 'ul>li>a' 
}); 

을 사용하여 다음과 같은 마크 업을

<ul class="app-nav"> 
    <li><a href="#!/testing">Link to testing route</a> 
</ul> 
... 
<a href="#!/testing">Other link to testing route</a> 

있다고 가정

$(document).on('click', function(e){ 

    var sender = e.target; // <-- Your event initiator 

}); 
0

설명서에 따라 Event Context이 원하는 것 같습니다.

this.target

이 컨텍스트를 보유하는 이벤트에 기인하는 DOM 소자. post, put 및 del 경로의 경우 경로를 트리거 한 양식 요소입니다.

게시 요청의 경우 제출 된 양식에서 일련 번호가 지정된 개체를 가져올 수 있습니다.

this.post('#:id', function() { 
    // this.target is the DOM form element that triggered the route 
    console.log($(this.target).serialize()); 
}); 
관련 문제