Prevent default single click event on double click on a link in HTML
问题 My code is pretty simple: var clickCount = 0, clickEl = []; var manualClick = false; $(document).on('click', 'a', function (e) { if (e.altKey || e.ctrlKey || e.shiftKey) { return; } clickCount = clickCount + 1; clickEl[clickCount] = this; var that = this; if (1 === clickCount) { setTimeout(function () { if (2 === clickCount && clickEl[1] === clickEl[2]) { window.stop(); embed_anchor(that); } clickCount = 0; }, 250); } }); It basically checks if there is double click. If yes, it cancel the