Tuesday, March 25, 2008

Unsupported by IE7/8: textContent()

IE 8 doesn't implement textContent.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>Broken textContent()</title>
</head>

<body>
<p id="textcontent">
It's called textContent()
Got any?
</p>
<script type="text/javascript">
alert(document.getElementById('textcontent').textContent);
alert(document.getElementById('textcontent').innerHTML);
</script>
</body>
</html>

No comments: