Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

147
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!