Posts Tagged ‘innerText’

Plain Text vs innerText vs textContent

Wednesday, September 1st, 2010

innerText and textContent are properties that get or set the text of an element or all its children. Internet Explorer implemented innerText in version 4.0, and it’s a useful, if misunderstood feature. WebKit also has innerText, carefully copying from, and even improving upon IE; and additionally has the standards compliant textContent, which we shall see, is no where near as useful and is in fact quite different. Firefox has textContent but not innerText, and a common mistake is writing code that retrieves one or the other, assuming the result will be the same (it’s not). Opera has the property, but it is little more than an alias of textContent, which to me is analogous to false advertising.
(more…)