Forum Moderators: open
I have done some searching but can't find anything and am hoping for some help.
I have some span tags
<span id="span_to_change">tester</span>
JAVA
******
document.getElementById('span_to_change').innerText = 'new text to display';
It doesn't error but it also doesn't change the value of the span... any insight as to what I am missing?
try using innerHTML for better support across browsers. Best yet is to test what is supported, then do accordingly...
var tag = document.getElementById('span_to_change');
if (tag.innerHTML) { tag.innerHTML = 'new text to display'; }
else if (tag.innerText) { tag.innerText = 'new text to display'; }