Skip to content

Instantly share code, notes, and snippets.

@pavlakis
Created November 28, 2017 12:37
Show Gist options
  • Save pavlakis/9fe987d8b20b0df3e196b3c3c790d024 to your computer and use it in GitHub Desktop.
Save pavlakis/9fe987d8b20b0df3e196b3c3c790d024 to your computer and use it in GitHub Desktop.
Handling double-click on single click events
function bindMessageButton() {
"use strict";
var $msgButton = $('a.msg');
$msgButton.attr('href', '#');
$msgButton.on('click', function (e) {
e.preventDefault();
$msgButton.unbind();
$msgButton.removeAttr('href'); // fix for double click jump
// ... do stuff ...
bindMessageButton();
});
}
@pavlakis
Copy link
Author

Alternatively, always have href removed from the anchor tag and use a CSS class to change the cursor to a pointer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment