Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Object.innerText For IE And FF

DZone's Guide to

Object.innerText For IE And FF

·
Free Resource

function getInnerText(elt) {
	var _innerText = elt.innerText;
	if (_innerText == undefined) {
  		_innerText = elt.innerHTML.replace(/<[^>]+>/g,"");
	}
	return _innerText;
}

Then, replace:
var text = elt.innerText;
by:
var text = getInnerText(elt);
Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}