How do you attach a event to element which should be executed only once?
Answer Posted / 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 |
Post New Answer View All Answers
How to resolve conflicts with other libraries?
How does jquery store data related to an element?
What are the effects methods used in jquery?
What is the difference between jquery.get() and jquery.ajax()?
Define animate function in jquery?
How do you add an HTML element in DOM tree?
What is the use of val() method in jquery?
How to give face effect in jquery?
What are the different types of selectors?
Can we call c# codebehind method using jquery?
How can you apply a style on an element using jQuery?
Mention the advantages of cdn? : jQuery Mobile
Which operating system is more compatible with jQuery?
What is event preventdefault () and event stoppropagation () in jquery?
Can jquery be used to make an ajax request?