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 |
What are the different types of selectors in jquery?
Hide and show image on button click using jQuery?
Explain url paremeter of jquery ajax method?
What happen if you return false from a jQuery event handler?
Define data paremeter of jquery ajax method?
Is it possible to hold or delay document.ready execution for sometime?
Tell me can we have multiple document.ready() function on the same page? : jquery mobile
What is the need for jquery? : jQuery Mobile
Tell me how to select combobox select value and text using jquery?
How do you stop the currently-running animation?
How to set attributes of an element using jquery?
What is the use of clone method in jQuery?