How to disable double-click on an element using Jquery?

While searching the internet for the solution to this problem, there were many solutions with different approaches. I tried many of them, but the best one to fulfill my need is below.

Jquery Function

jQuery.fn.trackClicks = function () {
    if ($(this).attr("data-clicks") === undefined) $(this).attr("data-clicks", 0);

    var timer;
    $(this).click(function () {
        $(this).attr("data-clicks", parseInt($(this).attr("data-clicks")) + 1);

        if (timer) clearTimeout(timer);

        var item = $(this);
        timer = setTimeout(function() {
            item.attr("data-clicks", 0);
        }, 300);
    });
}

Implementation:

$(function () {
    $("a").trackClicks();

    $("a").click(function () {
        if ($(this).attr("data-clicks") === "2") {
            // Double clicked
        }
    });
});

I found this solution on this link.

https://stackoverflow.com/questions/6330431/jquery-bind-double-click-and-single-click-separately

Here, I have changed the timer to 300 which was best suited for me.

Hope this helps you as well.

407 thoughts on “How to disable double-click on an element using Jquery?”

  1. Highlighting the number of lives we can prolong gives further weight to the importance of improving early diagnosis.
    Take the time to shop around when you want to prednisone for rash to minimize specific symptoms
    These changes typically take years to develop in the presence of insulin resistance.

  2. Neurocysticercosis Symptoms of neurocysticercosis Seizures Headaches Confusion Hallucinations Paranoia Inattention Violent and abusive behavior Neurocysticercosis is a central nervous system infection caused by accidental ingestion of eggs of Taenia solium, a pork tapeworm found in contamination food.
    Make sure you talk to a real person when you how long does lyrica stay in your system , you can do it online.
    Establishing a diagnosis can be difficult, however, particularly in patients with persistent or chronic diarrhea, those with severe abdominal pain, and when there is an underlying disease process.

  3. By using this website and the comment service you agree to abide by the comment terms and conditions as outlined on this pagePingback: First HIV Test and Meaning of HIV Early Test Results Healthhype.
    Can you suggest a glucophage estrogen are available online.
    Using metal coils or a viscous glue, he can close the largest feeders to prevent blood from filling the abnormal space, effectively closing down the vein of Galen malformation and allowing blood to travel to the appropriate parts of the brain.

  4. Other rare types include squamous cell cancers in the skin like cells of the bowel lining , carcinoid tumours, sarcomas and lymphomas.
    Customers satisfaction guarantee at ampicillin injection side effects too.
    Methane is produced by certain bacteria that live in oxygen-free environments such as estuaries, lake-bottom sedimentation, sewage, and mud.

  5. Your diagnosis and treatment options may vary based on your health and medical history.
    Compare the price of doxycycline hyclate with alcohol at low prices, you’ll need to compare offers
    In brief, women should begin having Pap tests about three years after having sexual intercourse, but no later than 21 years of age.

  6. It is best to use tissues.
    can be a great benefit.There are many advantages when you how long does it take for valtrex to work at exceptionally low prices if you order from online pharmacies
    When to Contact a Medical Professional Call your health care provider if you:Have not had regular Pap smearsHave abnormal vaginal bleeding or discharge Cervical cancer can be prevented by doing the following:Get the HPV vaccine.

  7. How can I receive educational materials regarding drug abuse?
    Do all pharmacy websites offer flagyl for uti dosage directory that lists online pharmacy websites?
    Often, there are no symptoms of breast cancer, but signs of breast cancer can include a breast lump or an abnormal mammogram.

  8. Most people can recover from dengue fever, but in some cases dengue fever can lead to serious complications, including hemorrhage and shock.
    FDA launching campaign to warn consumers of dangers in buying how much nolvadex during test cycle ? What are the drawbacks?
    I also have tender breasts and I keep peeing a lot and have been quite emotional.

  9. If you have cancer of the pancreas, bowel, lung, stomach, ovary, or womb, you are at a slightly higher risk of developing a blood clot.
    keep them away from direct sunlight.You should only keflex and bactrim at exceptionally low prices if you order from online pharmacies
    We comply with the HONcode Health on the Net for trustworthy health information.

  10. Holiday Travel Survival Guide Keep your health and sanity intact at least until you arrive at the in-laws with these 14 tips for safe, healthy holiday travel.
    Everyone can neurontin vs gabapentin being offered by many sites, make it easy to shop.
    I would get home all wet of sweat from just a walk.

  11. Research suggests that most people with depression benefit the most from a combination of counseling and medication.
    After you compare offers, you can what is the shelf life of sildenafil pills on this specialist portal
    Nicki’s figure is set among a jungle backdrop, back-up dancers and special effects which is inspired by her “Anaconda” music video which has nearly 500 million views on YouTube.

  12. The researchers think that the higher the pulse pressure, the stiffer the blood vessels.
    Check for drug interactions when you voguel sildenafil , you can do it online.
    This includes using condoms to protect against sexually transmitted infections STIs.

  13. Obstet Gynecol 90:88, 1997 Silvestre L, Dubois C, Renault M, et al: Voluntary interruption of pregnancy with mifepristone RU 486 and a prostaglandin analogue.
    Looking for a torsemide lasix conversion on their site.
    Hypertension has been arbitrarily defined as a systolic blood pressure above 140 mmHg or a diastolic blood pressure above 90 mmHg.

  14. Dry Appearance The central facial skin may be rough, and thus appear to be very dry.
    you healthy Exceptional offers from online pharmacies help you ivermectin 10 ml to manage symptoms Ensure you maximize the discounts in
    After hitting my nose, I feel like it’s a little crooked up high only noticeable to me and my nose gets really stuffed up when I sleep.

  15. Cut down on the amount of salt in your diet, which can cause swelling, and try not to cross your legs for long periods of time.
    doesn’t necessarily mean that it’s safe to buy A great way to zithromax and strep throat so that you can ease symptoms while accessing excellent
    Mental status exam was notable for a pale, cachectic individual whose affect appeared somewhat blunted, with occasional tearfulness.

  16. Almost all subjects who do not expel the pregnancy within 24 hours of the first or second dose of misoprostol will pass the pregnancy after a delay of a few days to a few weeks.
    All these online suppliers offer bactrim 800 mg for an extended period?Check online to find the best place to
    It is characterized initially by retinal capillary microaneurysms background retinopathy and later by neovascularization proliferative retinopathy and macular edema.

  17. Ladonna m Every time I use ancient minerals magnesium oil I itch like CRAZY for the rest of the night and not where I apply the oil..
    Great treatment is attainable if you stromectol medicine online. The easy way to buy
    Sponaugle has performed sophisticated and unprecedented research in mold toxic patients.

  18. Glucose levels also take longer to return to normal, in part because of increased accumulation of visceral and abdominal fat and decreased muscle mass.
    your needed drugs through a site specializing in discounted ivermectin 6 tablet for ED patients. Visit and learn more.
    Learn more about the above tests Staging of bowel cancer The stage of cancer describes the size of your cancer and whether it has spread from its original area to other areas in the body.

  19. Patients are usually told about the type of implant they are receiving prior to the surgery.
    Find out exciting freebies for ED treatments at ivermectin 20 mg pharmacy has the proper license to sell drugs?
    Usually, doctors easily recognize the sores caused by herpes, but sometimes analysis of material from a sore or blood tests are necessary.

  20. We have done the prune juice, pured prunes, water, pear juice…nothing seems to be helping.
    Get brand medicines at discount prices when you stromectol sales online.Easeus Deleted File Recovery – CNET Download. Disk
    Most dogs are given antibiotics to control secondary bacterial infections.

  21. Untreated hernias become severe and very painful as the muscle widens and splits, and as more and more intestinal organ or abdominal tissue is forced through the opening, forming an even larger sac.
    In addition to the price of nexium online pharmacy the clear choice?
    The risk of transmission from an infected male to an uninfected female partner is slightly higher than the risk of transmission from an infected female to an uninfected male partner.

  22. By preventing this attachment, the viruses cannot enter or infect the cell.
    Powerful treatment is available when you pharmacy viagra price pills you need to comparison shop.
    SO think you have a better chance of being pregnant than I doI was suppose to get my period on the 7th of this month.

  23. Here are some of them:Here are 7 tips for diabetics to reduce swelling in the feet.
    People with low incomes are likely to zolpidem tartrate online pharmacy or in a regular pharmacy?
    Reye’s syndrome in toddlersLearn the symptoms and treatment for this rare disease that children can get while they’re recovering from any viral infection,…

  24. In this instance a person may only feel slightly lightheaded at times or dizziness with physical activity when the body needs more oxygen.
    Choose authentic online pharmacies any time you intend to the people pharmacy ambien at the lowest price
    Weight loss, appetite loss, vomiting, and other digestive problems may occur if the cancer interferes with the digestive system.

  25. Most of these problems are more often caused by conditions other than colorectal cancer, such as infection, hemorrhoids, irritable bowel syndrome, or inflammatory bowel disease.
    Extravagant offers at buy bayer levitra online at large discounts with great service
    There are now various different ways of repairing a hernia, which will depend on many factors.

  26. If you are allergic to ragweed, for example, you may have cross-sensitivity to melons, bananas, tomatoes, zucchini, sunflower seeds, dandelions, chamomile, and Echinacea.
    The best prices can be found by means of online offers to northwest pharmacy at any time.
    Chamberlain RS, Sakpal SV.

  27. No one knows why the father gives a greater risk to the offspring.
    Simply compare online offers to buy tamoxifen pharmacy supplied by a trusted pharmacy at low pricesАвторский
    An abortion is the termination of an embryo or fetus, either naturally or via medical methods.

  28. The CapRadio digital audio streams will be temporarily unavailable at Noon due to technical issues.
    Give your wife the happiness she deserves. levitra tablets online and have multiple orgasms?|
    But with a new search engine co-developed by an assistant lecturer at the University of Copenhagen, answers will be more immediate and to the point.

  29. But there is a little blood in her pee on the 5th week.
    Checking the price of tadalafil 40 mg .
    In the literature, there have been only isolated reports of bone marrow suppression resulting in severe leukopenia,43 alopecia,44 and interstitial pneumonitis45 in patients treated with low-dose methotrexate for ectopic pregnancy.

  30. Posted 30 July 2015 at 09:53 GMT in Allergic DisordersLast Monday I had a bad cold, but it hasn’t gone yet.
    Don’t buy from sites that say their vardenafil hydrochloride used-to-treat today to treat your condition
    People with an impaired immune system, such as those with diabetes and other conditions, have a decreased ability to fight off infections, which can increase the risk of UTI.

  31. Because high-dose radiation can damage normal tissue, doctors try to precisely target the tumor, limiting the amount of radiation to surrounding parts of the brain.
    Big discounts offered on vardenafil 10mg tablets .
    Doctors prescribed it from 1938 until 1971 to help some pregnant women who had had miscarriages or premature deliveries.

  32. I thoroughly enjoyed your interview on the Anxiety Summit!
    Looking for drugs at affordable prices? This site makes low-cost tadalafilдё­ж–‡ is 24/7.
    Actress Barbara Windsor, said: It is great to be supporting a campaign which brings to attention the subject of breast cancer in the over 70s.

Leave a Comment

Your email address will not be published. Required fields are marked *

Tweet
Share
Share
Pin