Test Link

Click anywhere, the click handler was bound to the window, when it should not have. It should only be on "Test Link".


link = document.getElementById('link'),
other = document.getElementById('noExist'); // other element, maybe it is null

// okay, now lets attach a click handler to both values
jQuery([link, null]).bind('click', function (e) {
  alert('You just clicked on a <' + e.target.tagName + '> element');