add prefix to item id when using as html id
prevents accidental re-use of html ids
This commit is contained in:
parent
bde640c6e3
commit
4bf4f754c9
1 changed files with 2 additions and 2 deletions
|
@ -28,7 +28,7 @@ function renderItems() {
|
|||
clone.querySelector(".name").textContent = item.name;
|
||||
clone.querySelector(".content").textContent = item.content;
|
||||
clone.querySelector(".note").textContent = item.note;
|
||||
clone.querySelector(".result").id = id;
|
||||
clone.querySelector(".result").id = `item-${id}`;
|
||||
clone.querySelector("a").href = `form.html?id=${id}`;
|
||||
if (item.hidden) {
|
||||
clone.querySelector(".result").classList.add('hidden')
|
||||
|
@ -69,7 +69,7 @@ function search(e) {
|
|||
const regex = new RegExp(query, 'i')
|
||||
|
||||
for (const elem of document.getElementsByClassName('result')) {
|
||||
const item = items[elem.id];
|
||||
const item = items[elem.id.substr(5)];
|
||||
let found = false;
|
||||
if (query) {
|
||||
for (const a in searchAttrs) {
|
||||
|
|
Loading…
Reference in a new issue