Saturday, 24 August 2013

Previous Interview Question Next Interview Question
Home

How do you attach a event to element which should be executed only once?

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.
$(document).ready(function() {
    $("#btnDummy").one("click", function() {
        alert("This will be displayed only once.");
    });
});​

Previous Interview Question Next Interview Question
Home

0 comments :

Post a Comment