Site. Fixed an error in javascript when the page does not have a tag with the .documentation-version__button class.

This commit is contained in:
Leonid Nikitin 2024-07-26 22:06:21 +05:00
parent b33362a235
commit 707762d29b
Signed by: kor-elf
GPG Key ID: 3C0F720C170F6E1D

View File

@ -1,8 +1,10 @@
let blockDocumentationVersion = document.querySelector('#documentation-version'); let blockDocumentationVersion = document.querySelector('#documentation-version');
blockDocumentationVersion.querySelector('.documentation-version__button').addEventListener('click', (e) => { if (blockDocumentationVersion) {
blockDocumentationVersion.querySelector('.documentation-version__button').addEventListener('click', (e) => {
if (blockDocumentationVersion.classList.contains('active')) { if (blockDocumentationVersion.classList.contains('active')) {
blockDocumentationVersion.classList.remove('active'); blockDocumentationVersion.classList.remove('active');
} else { } else {
blockDocumentationVersion.classList.add('active'); blockDocumentationVersion.classList.add('active');
} }
}); });
}