Need to get the value 40.78
from <span>
to be stored in <span id ="test">
.
Tried the code below. But not able to figure out what's going wrong. The error getting on console is :
Uncaught ReferenceError: div is not defined.
Any help would be really appreciated.
var span = div.getElementsByTagName("span");
var test = document.getElementById('test');
console.log(test.innerHTML = span.innerHTML);
<span>40.78</span>
<span id="test"></span>