Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

142
Visualizações
Add Aria Label to a Link

trying to make a website accessible. There is a close menu button that's missing an Aria Label and i'm trying to add one by using JS.

I'm using the following script in order to target the ID and add the attribute, but while the script loads, the aria label is not added.

<script>
    function addAriaLabel() {
// Create an aria label attribute:
const addAria = document.createAttribute("aria-label");

// Set the value of the aria-label attribute:
addAria.value = "close button";

// Add the href attribute to an element:
document.getElementById("cart-accessibility").setAttributeNode(addAria);
    }
</script>

For reference the location of the element is https://outletbrands.gr/shop-2 (the filters closing button)

What am I doing wrong?

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

Seems like I solved the issue. I was missing the trigger.

Added:

window.onload = addAriaLabel;

and now works correctly.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda