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

148
Views
give attributes to <option> from javascript

So, I have this piece of JS:

for(var index in response.rates) {
    select.options[select.options.length] = new Option([index], index);
}

It generates the and tags populated with an array.

How can I give attributes to from there? Like onselect and and other things.

Thanks

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

0

Assign the option to a variable then you can give it attributes.

for(var index in response.rates) {
    let option = new Option(index, index);
    option.addEventListener("select", ...);
    select.options[select.options.length] = option;
}
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!