For a given Text node in the DOM, one can use one of these properties to retrieve its text:
textContentdatanodeValuewholeText
But which one to use? Which one is the most reliable and cross-browser supported?
(If multiple properties are 100% reliable and cross-browser, then which one would be most appropriate?)
nodeValueshould beis cross-browser compatible. It is part of the original DOM Level 2 specification.Also have a look at the compatibility table of quirksmode.org for that matter (that’s what I always use to see which properties are supported by which browsers).