Skip to content

Instantly share code, notes, and snippets.

@m8rge
Created November 24, 2014 07:00
Show Gist options
  • Save m8rge/a8dfa2e40ac396be12da to your computer and use it in GitHub Desktop.
Save m8rge/a8dfa2e40ac396be12da to your computer and use it in GitHub Desktop.
Validate on page anchors consistence on github
(function() {
$('article').find('a:not(.anchor)[href^=#]').each(function (i, e) {
var id = $(e).attr('href').replace(/^#/, '');
if ($('a[id="' + decodeURI(id) + '"]').length == 0) {
console.log(e);
} else {
console.log('validated');
}
});
}());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment