개발중/JavaScript
이벤트 한번만 실행
Binsoo
2021. 2. 24. 15:58
728x90
반응형
.one()
특정 처리기를 한 번만 실행해야 하는 경우도 있습니다. jQuery는 이 목적을 위해 메서드를 제공합니다.
$( "p" ).one( "click", function() {
console.log( "You just clicked this for the first time!" );
$( this ).click(function() {
console.log( "You have clicked this before!" );
});
});
728x90
반응형