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
Explain deferred and promise object in jquery? : jquery mobile
Explain the use of the $.fn.bind and $.fn.trigger.
Can you use multiple document.ready() function on the same page?
How method can be called inside code behind using jQuery?
What are the basic selectors in jQuery?
What is CDN?
What are the advantage of using cdn? : jquery mobile
Why is only the first page of multi page document loaded? : jquery mobile
Tell me how to check data type of any variable in jquery? : jquery mobile
Why do we need to go for JQuery?
How to submit a form without submit button using jquery?
Explain why there are two different version of jquery library? : jquery mobile
Create a plugin that would add and remove a class on hover.
Explain .delegate()? : jquery mobile
How to executed jquery selectors? : jquery mobile