[JavaScript - 기능 - (9) ] .unbind('click') : 이전에 넣은 이벤트 빼기
See the Pen jQuery Unbind Namespace by UX Team (@UXTEAM) on CodePen.
빨간색 버튼을 누르면 초록색 버튼의 이벤트를 빼는 것이다. ( .unbind()함수를 쓰면 된다. )
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
======HTML======
<div id="wrapper" class="p-5">
<button id="test" class="btn btn-outline-success">Test Message</button>
<button id="unbind" class="btn btn-outline-danger">Unbind Test Message</button>
</div>
======JS======
$('#wrapper').on( "click.demo", "#test", function() {
console.log( alert('clicked') );
});
$('#wrapper').on('click', '#unbind', function(){
$('#wrapper').off('click.demo', '#test');
})
|
'◽ HTML & CSS & JS, jQuery' 카테고리의 다른 글
[javascript - (30) ] input type 동적으로 변경하기 (0) | 2020.05.26 |
---|---|
[JavaScript - (29) ] encodeURI() : url로 서블릿에 파라미터 값 (한글) 넘길 시 (0) | 2020.05.23 |
null과 undefined (0) | 2020.04.20 |
[JavaScript - 기능 - (10) ] 스트링값을 숫자로 바꾸기. (0) | 2020.04.02 |
[JavaScript - 기능 - (9) ] .innerText, .textContent : 특정위치의 값 가져오기. (0) | 2020.03.24 |
[JavaScript - 기능 - (8) ] select box선택에 따라 다음 select box 영향 주는 방법. (0) | 2020.03.19 |
[JavaScript - 기능 - (8) ] "checkbox"의 체크 여부 확인. (0) | 2020.03.16 |