Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 공헌감
- 아웃풋법칙
- 모두가 기다리는 사람
- CSS
- kubernetes
- 쿠버네티스
- HTML
- try-with-resources
- 도파민형 인간
- 뉴 컨피던스
- ESG
- java
- 참조 계수
- try width resources
- 월칙
- 부자의그릇
- 칭기즈칸의 위대한 장군 수부타이
- 비메모리 자원
- 과제의 분리
- colllection
- 수부타이
- node
- 히든 스토리
- sentry
- apache kafka
- Container
- 레퍼런스 복사
- Infresh
- docker
- 이펙티브 자바
Archives
- Today
- Total
Hi
간단한 이벤트 연결/제거 본문
간단한 이벤트 연결/제거
간단한 이벤트 연결
간단한 방식으로 연결할 수 있는 이벤트
blur | focus | focusin | focusout | load |
resize | scroll | unload | click | dbclick |
mousedown | mouseup | mousemove | mouseover | mouseout |
mouseenter | ouseleave | change | select | submit |
keydown | keypress | keyup | error | ready |
간단한 방식으로 이벤트를 연결할 때 다음과 같은 방법을 사용
$(selector).method(function(event) {});
이벤트 연결 메서드도 제공됨
hover
: mouseenter 이벤트와 mouseleave 이벤트를 동시에 연결합니다.
다음과 같은 형태로 사용
$(selector).hover(function(event) {}, function(event) {});
이벤트 연결 제거
off()
: 이벤트를 제거합니다.
3가지 형태
$(selector).off()
$(selector).off(eventName)
$(selector).off(eventName, function)
ex)
$(document).ready(function() {
// 이벤트를 연결합니다.
$('h1').click(function() {
// 출력합니다.
$(this).html('CLICK');
alert('이벤트가 발생했습니다.');
// 이벤트를 제거합니다.
$(this).off();
});
});
'WEB(웹) > jQuery' 카테고리의 다른 글
이벤트 객체 (0) | 2018.07.02 |
---|---|
매개변수 context (0) | 2018.07.01 |
이벤트 연결 기본 (0) | 2018.07.01 |
문서 객체 삽입/이동/복제 (0) | 2018.06.30 |
문서 객체 삽입 (0) | 2018.06.30 |