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

174
Views
how to change `ari-label` description dynamically with javascript

how to change the value of 'ARIA-LABEL` according to user's precise language

getLang(element): void {
  let lang = element.document.getElementsByTagName('html')[0].getAttribute('lang');

  const labelAria = element.document.querySelector('[aria-label]');

  if(lang === 'en'){
   ?????
  }

}

Seeem give me some guidance I will be very grateful

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

I'm not sure what you mean by element.document but here is the correct way:

const labelAria = document.getElementById('element-id');

// set attribute
if(lang === 'en'){
   labelAria.setAttribute('aria-label', 'description here');
}

But if you really want to get the element by its aria label:

const labelAria = document.querySelector('div[aria-label="description here"]');

// set attribute
if(lang === 'en'){
   labelAria.setAttribute('aria-label', 'description here');
}

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!