diff --git a/grip/templates/index.html b/grip/templates/index.html
index 10970f0..de3902c 100644
--- a/grip/templates/index.html
+++ b/grip/templates/index.html
@@ -49,9 +49,9 @@
function scrollToHash() {
if (location.hash && !document.querySelector(':target')) {
- var element = document.getElementById('user-content-' + location.hash.slice(1));
- if (element) {
- element.scrollIntoView();
+ var elements = document.getElementsByName('user-content-' + location.hash.slice(1));
+ if (elements.length) {
+ elements[0].scrollIntoView();
}
}
}