jQuery unbind() 메서드

❮ jQuery 이벤트 메소드

예시

모든 <p> 요소에 대한 모든 이벤트 핸들러를 제거합니다.

$("button").click(function(){
  $("p").unbind();
});

정의 및 사용

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

unbind() 메서드는 선택한 요소에서 이벤트 핸들러를 제거합니다.

이 메서드는 모든 또는 선택한 이벤트 핸들러를 제거하거나 이벤트가 발생할 때 지정된 함수의 실행을 중지할 수 있습니다.

이 메서드는 이벤트 개체를 사용하여 이벤트 핸들러를 바인딩 해제할 수도 있습니다. 이벤트가 특정 횟수만큼 트리거된 후 이벤트 핸들러를 제거하는 것과 같이 자체 내에서 이벤트의 바인딩을 해제하는 데 사용됩니다.

참고: 매개변수가 지정되지 않은 경우 unbind() 메소드는 지정된 요소에서 모든 이벤트 핸들러를 제거합니다.

참고: unbind() 메서드는 jQuery와 연결된 모든 이벤트 핸들러에서 작동합니다.


통사론

$(selector).unbind(event,function,eventObj)

Parameter Description
event Optional. Specifies one or more events to remove from the elements.
Multiple event values are separated by space.
If this is the only parameter specified, all functions bound to the specified event will be removed.
function Optional. Specifies the name of the function to unbind from the specified event for the element
eventObj Optional. Specifies the event object to remove to use. The eventObj parameter comes from the event binding function

직접 해보십시오 - 예


바인딩 해제 unbind() 메서드를 사용하여 요소에 대한 지정된 이벤트에서 특정 함수를 바인딩 해제하는 방법.


제거할 이벤트 개체를 지정합니다.


❮ jQuery 이벤트 메소드