More DOM differences

My incursion into the land of DOM scripting hit upon another difference between IE and Firefox, another simple example…

<Div id="test">
Hello there
</Div>

The task, use JavaScript to change the text in the Div, easy eh?

document.getElementById("test").firstChild.value = "new text"
or
document.getElementById("test").innerText = "new text"

Well, turns out I used both! IE seems to like the 2nd and Firefox the 1st, with neither complaining about the other. Now I can see why the AJAX libraries have their DOM abstraction functions!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s