how to set value in span using javascript code example Example: javacsript update text in span document.getElementById("myspan").textContent="newtext";