02.Unbind.htm |
<html xmlns="http://www.w3.org/1999/xhtml"> <head>
<title>이벤트 처리기 해제</title>
<script src="../jQuery/jquery-1.3.2-vsdoc2.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function()
{ //[!] 버튼 클릭시 메시지 출력 $('#btn').click(function() { alert('클릭됨');
}); //[1]
unbind() 메서드로 지정된 이벤트 해제 $('#btnUnbind').one("click", function()
{ $('#btn').unbind("click"); //바인딩 해제 });
});
</script>
</head> <body>
<div id="my">
<input type="button" id="btn" value="버튼" class="hover" />
<input type="button" id="btnUnbind" value="이벤트 해제" class="hover" />
</div> </body> </html> |
결과화면 |
[그림47-1] 버튼을 클릭하면 메세지 박스가 출력 이벤트 해제 버튼을 클릭 후 버튼 클릭시 아무런 반응이 없음 |
'jQuery | javascript | CSS' 카테고리의 다른 글
49.jQuery - fadeIn()과 fadeOut()으로 불투명도 표시 ( 08.Effects ) (0) | 2009.11.12 |
---|---|
48.jQuery - show()와 hide로 숨기기 및 보이기 ( 08.Effects ) (1) | 2009.11.12 |
46.jQuery - trigger 메서드로 click 행위 실행 ( 07.Events ) (0) | 2009.11.12 |
45.jQuery - margin을 포함한 높이와 너비 구하기 ( 06.CSS ) (0) | 2009.11.11 |
44.jQuery - Width와 Height값 크기 구하기 ( 06.CSS ) (0) | 2009.11.11 |
Comments