jQuery bind() 메서드

❮ jQuery 이벤트 메소드

예시

<p> 요소에 클릭 이벤트를 연결합니다.

$("p").bind("click", function(){
  alert("The paragraph was clicked.");
});

정의 및 사용

bind() 메서드는 버전 3.0에서 더 이상 사용되지 않습니다. 대신 on() 메서드를 사용하십시오 .

 bind() 메서드는 선택한 요소에 대해 하나 이상의 이벤트 핸들러를 연결하고 이벤트가 발생할 때 실행할 함수를 지정합니다.


통사론

$(selector).bind(event,data,function,map)

Parameter Description
event Required. Specifies one or more events to attach to the elements.

Multiple event values are separated by space. Must be a valid event.
data Optional. Specifies additional data to pass along to the function
function Required. Specifies the function to run when the event occurs
map Specifies an event map ({event:function, event:function, ...}) containing one or more events to attach to the elements, and functions to run when the event occurs

직접 해보십시오 - 예


연결 요소에 여러 이벤트를 연결하는 방법입니다.


을 사용하여 선택한 요소에 여러 이벤트/기능을 첨부하는 방법.


에 데이터 전달 사용자 지정 명명된 이벤트 핸들러에 데이터를 전달하는 방법.


❮ jQuery 이벤트 메소드