110
rated 0 times
[
114]
[
4]
/ answers: 1 / hits: 16750
/ 13 Years ago, wed, october 19, 2011, 12:00:00
I wanted to ask how to change div content, but not using innerhtml.
More From » dom
I wanted to ask how to change div content, but not using innerhtml.
You can use nodeValue
to access the value of a node, however the value of a div
. In your example you might have the following HTML...
<div id=myLovelyDiv>This is the text that you want to change</div>
and this script...
var myDiv = getElementById(myLovelyDiv);
myDiv.childNodes[0].nodeValue = The text has been changed.;
but I fail to see why you wouldn't use
myDiv.innerHTML = The text has been changed properly.;