I noticed that when i try to get the new content from a div, the browser returns the old content of the div.
<div id="here">Old text</div>
<script>
document.getElementById('here').innerHTML = "New text";
</script>
Now the div text has changed:
<div id="here">New text</div>
But when i try to alert the innerHTML of the div, i get the old text. Can you please tell me why, and how can i get the new text?
EDIT
Excuse me, i have provided a wrong javascript code. This is corect:
var text = document.getElementById('here').innerHTML;
document.getElementById('here').innerHTML = "New text";
alert(text); // returns "Old text"