Build a Bookmark Manager App - Build a Bookmark Manager App

Tell us what’s happening:

My viewCategoryBtn.addEventListener isn’t working properly.

When I press the button (after adding two bookmarks) it shows 2 radio buttons but with no text.

I am passing steps 17, 18 and 19 (although I don’t see the text)
but is failing test 20. I get the following error:

20. Each label element should contain an anchor element with the bookmark name as text, and the href attribute set to the bookmark URL.

I have looked at other submissions and seem to be doing the same sort of thing

Your code so far

/* file: script.js */
viewCategoryBtn.addEventListener("click", () => {
  const category = categoryDropdown.value;
  //test 16 ✔
  categoryName[0].innerText = category;
  categoryName[1].innerText = category;
  categoryList.innerHTML = "";

  const bookmarks = getBookmarks();
  const arr = bookmarks.filter(item => item.category === category);
  //step 17 ✔
  if (arr.length === 0) {
    categoryList.innerHTML = `<p>No Bookmarks Found</p>`;
  } else {
  //step 18 X
  //step 19 X
  //step 20 X
    arr.forEach(bm => {
      const name = bm.name;
      categoryList.innerHTML +=
        `
        <input type="radio" id="${name}" name="listbtn" value="${name}" />
        <label for="${name}" <a href="${bm.url}" target="_blank">${name}</a></label>
        `;
    })
  }

<!-- file: index.html -->

/* file: styles.css */

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:147.0) Gecko/20100101 Firefox/147.0

Challenge Information:

Build a Bookmark Manager App - Build a Bookmark Manager App

here you have a syntax error, make sure you write the correct HTML for the label

for more help please share all your code

Thank you for replying - I see my error now - probably because I was trying to type it all one one line :frowning:

Thank you again

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.