How do you attach a event to element which should be executed only once?
Answer / chaitanya
Using jQuery one() method. This attaches a handler to an event for the element. The handler is executed at most once per element. In simple terms, the attached function will be called only once.
Hide Copy Code
$(document).ready(function() {
$("#btnDummy").one("click", function() {
alert("This will be displayed only once.");
});
});
Is This Answer Correct ? | 0 Yes | 0 No |
Explain .delegate()? : jquery mobile
How to disable cut,copy and paste in TextBox using jQuery?
How we can select multiple elements in jquery?
what does $("div") will select? : jquery mobile
How is the deferred method in jquery important in relation to animate method?
How to create clone of any object using jQuery?
Can we have multiple document.ready() function on the same page? : jquery mobile
Why we need jquery?
How can an element be checked if it contains a specific class?
What is the difference between text() and html() in jquery?
Define the use of each function in jquery?
Why is the block display style used for animations?