mirror of
https://github.com/freedombox/FreedomBox.git
synced 2026-03-11 09:04:54 +00:00
tags: Fix issue with JS init on a page without tags
- On a page without tags, tags.js still loads and initializes. When a tag input search bar does not exist on the page, this leads to a harmless exception getting printed on the browser console. Signed-off-by: Sunil Mohan Adapa <sunil@medhas.org> Reviewed-by: Veiko Aasa <veiko17@disroot.org>
This commit is contained in:
parent
4705a86f90
commit
536721df19
@ -175,7 +175,9 @@ document.addEventListener('DOMContentLoaded', function () {
|
||||
});
|
||||
|
||||
const addTagInput = document.getElementById('add-tag-input');
|
||||
addTagInput.addEventListener('keyup', onTagInputKeyUp);
|
||||
if (addTagInput) { // When page loads without tag input element
|
||||
addTagInput.addEventListener('keyup', onTagInputKeyUp);
|
||||
}
|
||||
|
||||
const dropdownItems = document.querySelectorAll('.tag-input li.dropdown-item');
|
||||
dropdownItems.forEach(item => {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user