I am attempting to extract certain elements based on the order they appear in the code. Unfortunately there are some other elements in this webpage that are unneeded. I want to extract text 1
and text
and Text 3
and the second text
in the example I created below. I'm unable to do this by location like the link below asks because I need to get the elements by a class and element name with
document.querySelectorAll('.classname b');
Both elements (the one on the left and the one on the right) need to be accessed this way. How could I do this? Thanks!
Example:
<td class="class"><a><img><b>PA3B-2 DESIGN & MANUF WT</b></a></td>
then
<td class="letter">
100%
<b>A</b>
</td>
I want to take out PA3B-2 DESIGN & MANUF WT
with A
.
And this repeats except occasionally does not have the 2nd part (class="letter")