Binding to Click and Focus

Binding to click and focus fires twice on all browsers except on Chrome.

by napotopia

HTML

<p>View console log to watch the events fire.</p>
<p>Chrome fires only once. all other browsers fire twice.</p>
<p><a class="jLink" href="http://www.jquery.com">Open Shortform.</a></p>

<div id="shortForm" class="hidden">Short Form</div>

CSS

.hidden {
    display: none;
}

body {
    margin: 10px;
}

JavaScript

$('#container a.jLink').not('.default').bind('click focus', function(e) {
    console.log('e: ', e.timeStamp, e.type, e);
    e.preventDefault();
    $('#shortForm').removeClass('hidden');
});