diff --git a/site/content/docs/5.0/examples/cheatsheet/cheatsheet.js b/site/content/docs/5.0/examples/cheatsheet/cheatsheet.js index 541cf9350a..0a50258b92 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