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

140
Views
How to use data attribute name and value in HTML-slightly

We have a requirement to get the attribute value and set it in the script file. So , How can we check the date-attribute-name(id, url, etc..) and set the value in the one trust script. Please verify and let me know your thoughts.

Thanks!

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

0

you can use getAttribute & setAttribute methods

for example

document.getElementById('element').getAttribute('id')
document.getElementById('element').setAttribute('id', 'newId')
about 4 years ago · Juan Pablo Isaza Report

0

You can use document.getElementById('element').getAttribute('id'). When the attribute not exists you will get a null.

So you can check later whether the attribute exists.

if (document.getElementById('element').getAttribute('id') !== null) {
   // continue
}
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!