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

187
Views
How to get particular element with a className?

I am using target.getElementsByClassName('numerical')) to get the list of elements with classname of numerical . I want to further filter only th from the list. How can i do that?

0: th.ant-table-cell.numerical
1: th.ant-table-cell.numerical
2: td.ant-table-cell.numerical
3: td.ant-table-cell.numerical
about 4 years ago · Juan Pablo Isaza
3 answers
Answer question

0

Use querySelectorAll

target.querySelectorAll('th.numerical')

I also suggest you read up on selectors

about 4 years ago · Juan Pablo Isaza Report

0

Well you can use querySelectorAll

target.querySelectorAll('th.numerical'))

This will give you all th elements with className of 'numerical'.

about 4 years ago · Juan Pablo Isaza Report

0

You can create an array from element you get with getElementsByClassName and filter them like this

Array.from(target.getElementsByClassName('numerical'))
    .filter((tag) => {
        return tag.tagName === "TH");
    });

Here I use Array.from function to convert the result of getElementsByClassName to Array as it is an instance of HTMLCollection which is not iterable.

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!