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?
Hi, I'm trying to find a solution for images and the mandatory
altattribute. And also for even more attributes likearia-labelledby. Thelist.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 thealtattribute shows success in the console.log but the real list doesn't reflect the changes in the DOM.Part of the function:
I'm using the HTML template similar to this example from the website:
Maybe this doesn't work in this case?