Skip to content Skip to sidebar Skip to footer

Javascript To Get Text Node Of Td Using Tr Class

I have the following codes below: ... [Multiple lines ommited for brevity]
 

Solution 1:

You are selecting the tr element and not the first td that you really want. Try this:

const td = document.querySelector('.bibItemsEntry td:first-child');
const p = document.getElementById('demo');
p.innerHTML = td.textContent;

Solution 2:

const x = document.getElementsByClassName("bibItemsEntry")[0].firstElementChild.innerHTML;
const p = document.getElementById('demo');
p.innerHTML = td.textContent;

Post a Comment for "Javascript To Get Text Node Of Td Using Tr Class"