Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

144
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda