To get your span, you would typically use
document.querySelector (there are other functions that can fetch collections of related nodes, like
document.querySelectorAll). The former identify nodes by the property named in the method name (ID, or class name, respectively); the latter ones use CSS selectors. (All of the
getElement... functions can be replicated using the newer
querySelectorAll interface, though you have to know how to use CSS selectors. I almost never use
getElement... functions any more.) There are also functions that use XPath, though this is a bit more advanced subject.
Once you have the node, you can change its content using e.g.
.innerHTML properties, the former being for plain text, the latter for HTML.
For example, if this is the only
span on the page, this suffices:
document.querySelector('span').textContent = "Result";
If on the other hand you have more of them, you would need some way to target the correct one. I will also demonstrate how you can style it using HTML:
const node = document.querySelector('#result_goes_here'); node.innerHTML = "<strong>Result</strong> in bold!";