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

85
Views
Address attributes of HTML tags by CSS selector

I'm loading the name and id attributes of a <form> called contactForm to a javascript array like this:

const flds=[];
contactForm.querySelectorAll("input").
    forEach( value => { 
        flds.push([value.id, value.name])
    });
;
console.log(flds);

Can I do that directly without a loop? Something like:

const flds=contactForm.querySelectorAll("input [name,id]")
almost 4 years ago · Santiago Trujillo
1 answers
Answer question

0

I think the best you can do is a map function.

const flds = [...contactForm.querySelectorAll("input")].map(el => [el.id, el.name])
almost 4 years ago · Santiago Trujillo 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!