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 |
Can you give me a brief history of your programming days? Where did it all start?
How do you install/use jquery in a project.
How to work with jQuery parent(), children() and siblings()?
Difference between detach and remove? : jQuery Mobile
What is .empty()? : jquery mobile
Why there are two different version of jQuery library?
Can we select a element having a specific class in jquery ?
Explain why there are two different version of jquery library? : jquery mobile
What are the slow selectors in jQuery?
Define the script build up by jquery?
What is the use of css() method in jquery?
what are the features of jquery