How do I get the text of an element without the children?
Neither element.textContent nor element.innerText seem to be working.
HTML:
The text of an element is also a separate node. Consider this piece of code:
Some text
Inner text
More text
More inner text
Even more text
What do you mean now when you say you want the text of the element? Just the direct children?
Then this piece code of code may help:
for (var element in elements) {
if (element.nodeType == Node.TEXT_NODE) {
// do something
}
}