aboutsummaryrefslogtreecommitdiff
path: root/site
diff options
context:
space:
mode:
Diffstat (limited to 'site')
-rw-r--r--site/content/docs/5.0/examples/cheatsheet/cheatsheet.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/site/content/docs/5.0/examples/cheatsheet/cheatsheet.js b/site/content/docs/5.0/examples/cheatsheet/cheatsheet.js
index 541cf9350..0a50258b9 100644
--- a/site/content/docs/5.0/examples/cheatsheet/cheatsheet.js
+++ b/site/content/docs/5.0/examples/cheatsheet/cheatsheet.js
@@ -25,8 +25,8 @@
toast.show()
})
- // Disable empty links
- document.querySelectorAll('[href="#"]')
+ // Disable empty links and submit buttons
+ document.querySelectorAll('[href="#"], [type="submit"]')
.forEach(function (link) {
link.addEventListener('click', function (event) {
event.preventDefault()
@@ -41,6 +41,11 @@
}
var link = document.querySelector('.bd-aside a[href="' + hash + '"]')
+
+ if (!link) {
+ return
+ }
+
var active = document.querySelector('.bd-aside .active')
var parent = link.parentNode.parentNode.previousElementSibling