I am searching for the first class containing the text "Routed:"
and then I want to retrieve the following string. I attempted to utilize document.querySelector
, but I'm uncertain if this is the correct approach.
<td class="msvb2">Routed:</td>
<td class="msvb2">AAZ12332</td>
Edit update:
var tds = document.getElementsByClassName('ms-cellstyle ms-vb2');
var value, index = 0, length = tds.length;
for ( ; index < length; index++) {
- if (tds[index].textContent == 'Routed:') {
- value = tds[index].nextElementSibling.textContent;
- break;
- }
}
document.getElementsByClassName('ms-cellstyle ms-vb2').textContent = value;
console.log(textContent);
When running this script, I encounter the error:
Uncaught ReferenceError: textContent is not defined