.innerText and .textContent
Wednesday, February 22nd, 2012 21:10![[personal profile]](https://www.dreamwidth.org/img/silk/identity/user.png)
Today I learned that there is a standard-DOM alternative to the convenient IEism element.innerText
(a close relative of element.innerHTML
): element.textContent
.
It is slightly different, according to MDN: .innerText
returns the visible text (omitting scripts and CSS-hidden text), whereas .textContent
returns everything, more like walking the document tree.
(This information crossed my awareness while working on Caja, but I didn't recognize it as something I could actually make use of until now.)
ufwulhz1
Date: 2017-01-25 22:34 (UTC)