Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is event preventdefault () and event stoppropagation () in jquery?

693


What programming language does jquery use?

764


Explain deferred and promise object in jquery? : jquery mobile

739


Explain the difference between body onload() and document.ready() function? : jquery mobile

781


What is a jquery ajax?

712


Why should I use jquery?

794


What happen if you return false from a jQuery event handler?

804


Which version of jquery file should be used?

858


How we can select multiple elements in jquery?

779


What is the difference between the id selector and class selector in jquery?

766


What is the difference between "#" and "." selector in JQuery?

867


Give a brief idea about jquery mobile? : jQuery Mobile

717


Explain .empty() vs .remove() vs .detach() in jquery

708


What are the difference between alert() and confirm()?

829


How to resolve conflicts with other libraries?

802