UI

.on

by kay posted Apr 03, 2013
?

단축키

Prev이전 문서

Next다음 문서

ESC닫기

크게 작게 위로 아래로 댓글로 가기 인쇄

Test Url : http://www.uhoon.co.kr/test/800.html

API 링크 : api jquery .on 

 

delegate , live , bind  => on 으로 가는 추세라고합니다..

 

.on( events [, selector ] [, data ], handler(eventObject) )


function myHandler(event) {
  alert(event.data.foo);
}

$(function() {
    $("p").on("click", {foo: "bar"}, myHandler)
});
<p>TEST</p>

.on( events [, selector ] [, data ] )


$(function() {
    $("p").on("click", function(){
        alert( $(this).text() );
    });
});

<p>TEST</p>