Suppose I have the following html:
div id="my_div"><span>no no</span></div>
. I want to change the text no no with yes yes. I can do it as following:
document.getElementById("my_div").getElementsByTagName('span')[0].innerHTML = "yes yes"
But if I want to use things as variables like the following:
var x = document.getElementById("my_div").getElementsByTagName('span')[0].innerHTML;
x = "yes yes";
Now the text no no is not changed. Why?