Skip to content

Alt + href attribute (or fill more than one attribute) #786

@rotkohlsuppe

Description

@rotkohlsuppe

Hi, I'm trying to find a solution for images and the mandatory alt attribute. And also for even more attributes like aria-labelledby. The list.on() function has no listener for onbuild. That's my first problem. I'd like to have an event for after mounted.
If I use on 'updated' my callback function for altering the alt attribute shows success in the console.log but the real list doesn't reflect the changes in the DOM.

Part of the function:

items.forEach((item) => {
const name = item.getElementsByClassName("personname")[0].innerText;
const alt = `Potrait von ${name}`;
const image = item.getElementsByClassName("portrait")[0];
image.alt = alt;
console.log("image with new alt:", item, image.alt);
});

I'm using the HTML template similar to this example from the website:

<div style="display:none;">
  <!-- A template element is needed when list is empty, TODO: needs a better solution -->
  <li id="hacker-item">
   <h3 class="name"></h3>
   <p class="city"></p>
  </li>
</div>

Maybe this doesn't work in this case?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions