Clear the events effect after the event is finished running Code Answer

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of Clear the events effect after the event is finished running without wasting too much if your time.

The question is published on by Tutorial Guruji team.

I am using ahoy_matey gem . I am trying to record click event only when specific link is clicked.

So I have tried to do the following:

$("#lotto-bigyapan").on("click", function(){
ahoy.track("name", {element: "element"});
});

It works but the only problem here is, after I click on the specific link and everthing is working then if I click somewhere else then it ges recorded too. Is there a way to clear the effect once the click is stored in the db?

Answer

To make the click event only fire once per element, you can use jQuery’s one() method

$("#lotto-bigyapan").one('click', function(){
    ahoy.track("name", {element: "element"});
});
We are here to answer your question about Clear the events effect after the event is finished running - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji