xxxxxxxxxx
document.getElementById("myspan").textContent="newtext";
xxxxxxxxxx
var span = document.getElementById("customSpan");
span.textContent = "some text";
xxxxxxxxxx
<span id="span_Id">I am the Text </span>
var span_Text = document.getElementById("span_Id").innerText;
console.log(span_Text)