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 can you select all elements in a page using jquery?
How to check if number is numeric while using jQuery 1.7+?
What are the basic selectors in jQuery?
What is the difference between eq() and get() methods in jQuery?
What is the difference between text() and html() in jquery?
Define cdn in jquery?
What are the methods used to provide effects in jquery?
How to set attributes of an element using jquery?
what are the features of jquery
What is the difference between jquery.size() and jquery.length?
What does dollar sign ($) me in jquery?
What to do to select element having a particular class (".selected")? : jquery mobile