function preventDefaultOnPoundLinkClicks() {
  document.addEventListener('click', function(e) {
    var anchor = findAncestor(/** @type {Node} */ (e.target), function(el) {
      return el.tagName == 'A';
    });
    // Use getAttribute() to prevent URL normalization.
    if (anchor && anchor.getAttribute('href') == '#')
      e.preventDefault();
  });
}
/**
 * Call this to stop clicks on <a href="#"> links from scrolling to the top of
 * the page (and possibly showing a # in the link).
 */
Call this to stop clicks on  links from scrolling to the top of
the page (and possibly showing a # in the link).
Call this to stop clicks on links from scrolling to the top of the page ( and possibly showing a # in the link ) .
function preventDefaultOnPoundLinkClicks() {
  document.addEventListener('click', function(e) {
    var anchor = findAncestor( (e.target), function(el) {
      return el.tagName == 'A';
    });
    if (anchor && anchor.getAttribute('href') == '#')
      e.preventDefault();
  });
}
function preventDefaultOnPoundLinkClicks ( ) { document . addEventListener ( 'click' , function ( e ) { var anchor = findAncestor ( ( e . target ) , function ( el ) { return el . tagName == 'A' ; } ) ; if ( anchor && anchor . getAttribute ( 'href' ) == '#' ) e . preventDefault ( ) ; } ) ; }
Call this to stop clicks on <a href="#"> links from scrolling to the top of
 the page (and possibly showing a # in the link).
Call this to stop clicks on <a href = " # " > links from scrolling to the top of the page ( and possibly showing a # in the link ) .
/** @type {Node} */ // Use getAttribute() to prevent URL normalization.