Tuesday, February 14, 2017

the dom and innerHTML



codea
<textarea id="thedomandhtml" style="height: 100px; width: 400px;"></textarea>

<div id="thedomandhtml_testareacontainer"><a id="thedomandhtml_testarea" href="javascript:thedomandhtml()" style="color: greenyellow; font-size: 1.5em;">
before I get the innerHTML of the test div I'm going to change it using a DOM method ... so, will elementbyid.innerHTML return the original HTML or a modified version?
</a></div>

<script> 

function thedomandhtml() {

var testareacontainer = document.getElementById("thedomandhtml_testareacontainer")

document.getElementById("thedomandhtml_testarea").style.color = "violet"

document.getElementById("thedomandhtml").value = testareacontainer.innerHTML}

</script>
acode