Skip to content

Instantly share code, notes, and snippets.

@iamandrewluca
Created June 29, 2020 18:04
Show Gist options
  • Save iamandrewluca/7a9a192179b563a9d45aca69c82f3192 to your computer and use it in GitHub Desktop.
Save iamandrewluca/7a9a192179b563a9d45aca69c82f3192 to your computer and use it in GitHub Desktop.
Will search and mark duplicated IDs on a page #bookmarklet
javascript: void ((function() {
/* More bookmarklets at https://gist.github.com/iamandrewluca/61feacf07bc4f2f50e70f986c2e9b2d2 */
document.querySelectorAll('[id]').forEach(el => {
const specificIds = document.querySelectorAll(`[id="${el.id}"]`);
if (specificIds.length > 1 && specificIds[0] === el) {
console.log('Duplicate id ' + el.id);
specificIds.forEach(element => {
element.style.outline = '5px solid red';
});
alert('duplicate found');
}
});
})());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment