Home » Javascript » Why data-reactid is required when using getElementsByClassName?

Why data-reactid is required when using getElementsByClassName?

Posted by: admin October 29, 2018 Leave a comment

Questions:

I am trying to retrieve some data from a webpage table using getElementsByClassName but I only get some of the data. I noticed that the first half of the table uses the data-reactid attribute and if a table row does not use it, I will not retrieve the data.

The first 100 rows source code looks like this

<tr class="something" data-reactid="1520"> 

With incrementing react-id values. Those are the rows I am able to scarp.

The other rows code looks like this:
<tr class="something"> and those are being left out of the query.

What do I need to do to get all the elements using getElementsByClassName(“something”) ?

Answers: