mirror of
https://github.com/Hopiu/bootstrap.git
synced 2026-05-02 09:44:42 +00:00
docs(cheatsheet): fix JS errors in setActiveItem() (#34011)
This commit is contained in:
parent
58b1be927f
commit
83bcc3c00f
1 changed files with 7 additions and 2 deletions
|
|
@ -25,8 +25,8 @@
|
||||||
toast.show()
|
toast.show()
|
||||||
})
|
})
|
||||||
|
|
||||||
// Disable empty links
|
// Disable empty links and submit buttons
|
||||||
document.querySelectorAll('[href="#"]')
|
document.querySelectorAll('[href="#"], [type="submit"]')
|
||||||
.forEach(function (link) {
|
.forEach(function (link) {
|
||||||
link.addEventListener('click', function (event) {
|
link.addEventListener('click', function (event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
|
|
@ -41,6 +41,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
var link = document.querySelector('.bd-aside a[href="' + hash + '"]')
|
var link = document.querySelector('.bd-aside a[href="' + hash + '"]')
|
||||||
|
|
||||||
|
if (!link) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
var active = document.querySelector('.bd-aside .active')
|
var active = document.querySelector('.bd-aside .active')
|
||||||
var parent = link.parentNode.parentNode.previousElementSibling
|
var parent = link.parentNode.parentNode.previousElementSibling
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue