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 |
How to keep the submit text from showing with jquery mobile? : jquery mobile
How to select all elements using jQuery?
What is the slowest selector in jQuery?
Can we have multiple document.ready() function on the same page? : jquery mobile
JQuery or JavaScript which is quicker in execution?
What are source maps in jQuery?
List the basic selectors in jquery?
How do you implement animation functionality?
Explain the difference between jquery-x.x.x.js and jquery.x.x.x min.js?
What is jquery.holdready() function?
How can we show and hide an element via jquery?
What is jQuery plugin and what is the advantage of using plugin?