neubert neubert - 3 years ago 151
Javascript Question

textContent for JS without all the descendant nodes

I want to get the textContent of the current node but not of any of the descendant nodes. Any ideas as to how I might do that?

textContent does the later. nodeValue returns an empty string.

Answer Source

I just created a span within the current node that contains that node's specific textContent and am getting the txt for that. I dunno... seems easier than going over all the node's children. Thanks for the suggestion though!

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download