0
0
mirror of https://github.com/twbs/bootstrap.git synced 2024-11-29 11:24:18 +01:00

docs(cheatsheet): fix JS errors in setActiveItem() (#34011)

This commit is contained in:
Gaël Poupard 2021-05-18 07:31:15 +02:00 committed by GitHub
parent 58b1be927f
commit 83bcc3c00f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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