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 |
Why jQuery is better than JavaScript?
How to get the value of selected option in jquery?
How to Use the jQuery load() Method?
What are the selectors in jquery? How many types of selectors in jquery?
Jquery can be used in what scenarios?
How to resolve conflicts with other libraries?
Is numeric in jquery?
Hide and show image on button click using jQuery?
What is jquery toggle function?
Can we include multiple version of jquery? : jquery mobile
Back onto jquery ui' can you see jquery ui making more of an impression in the future, lead by the current successes of jquery?
What is the difference between the id selector and class selector in jquery?