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

Mention some advantages of jquery.

795


How we can select multiple elements in jquery?

776


What is the use of .size() method in jquery?

716


Define .siblings() method in jquery?

751


How to check data type of any variable in jquery? : jquery mobile

723


Create a plugin that would add and remove a class on hover.

729


How is body onload() function is different from document.ready() function used in jquery?

750


Explain the difference between parent() and parents() methods in jquery? : jquery mobile

769


What is the use of each function in jQuery?

793


How do you get the attribute of an html tag in jquery?

704


explain bind() vs live() vs delegate() methods in jquery

738


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

703


Define the script build up by jquery?

818


What is difference between onload and ready?

771


What is jquery mobile theming? : jquery mobile

776