on에 해당하는 글 1

jquery on 이벤트 핸들러

Open API/Jquery|2016. 10. 28. 10:12
반응형


jQuery on 이벤트 핸들러 사용방법



API  Link : http://api.jquery.com/on/


어쩌구 저쩌구 해서..


delegate , live , bind   =>  on 사용하시면 됩니다.



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

댓글()