검색결과 리스트
-- JQuery에 해당되는 글 38건
- 2013.10.04 How to Avoid Double Clicking With jQuery?
글
336x280(권장), 300x250(권장), 250x250, 200x200 크기의 광고 코드만 넣을 수 있습니다.
Introduction
There has been always troubling issue regarding user interaction,when the user Double Clicks the DOM elements. Such as buttons, links etc. Fortunately, jQuery has an awesome solution for this. That is .one()
method
What does .one Method Do?
It attaches a handler to an event for the elements and that handler is executed at most once per element
Example
$("#saveBttn").one("click", function () {
alert("This will be displayed only once.");
});
OR
$("body").one("click", "#saveBttn", function () {
alert("This displays if #saveBttn is the first thing clicked in the body.");
});
Key points of the above code:
- After the code is executed, a click on the element with Id
saveBttn
will display the alert - Subsequent clicks will do nothing
- This is equivalent to ==>
$("#saveBttn").on("click", function (event) {
alert("This will be displayed only once.");
$(this).off(event);
});
In other words explicitly calling .off()
from within a regularly-bound handler has exactly the same effect
출처 : http://www.codeproject.com/Articles/639084/How-to-Avoid-Double-Clicking-With-jQuery
'-- JQuery' 카테고리의 다른 글
load로 html의 특정 레이어만 불러오기 (0) | 2014.07.01 |
---|---|
jquery toggle method (0) | 2014.07.01 |
신규 Form을 만들어 기존 Form의 파라미터로 POST하기 (0) | 2013.09.27 |
같은 아이디인 여러 체크박스를 전체선택 (0) | 2013.02.08 |
Checking if jQuery is loaded vs. ready (0) | 2012.10.09 |
RECENT COMMENT