html - How do I change the content of a span element using javascript. .innerHTML method not working -
this question has answer here:
i'm trying change content inside of span element. i've tried :
<span id='spanid'> content </span> document.getelementbyid('spanid').innerhtml = blah blah
this not work , console returns :
'typeerror: null not object'
you have type error here
use document.getelementbyid('spanid').innerhtml = "blah blah"
but modern browsers :
use document.getelementbyid("spanid").textcontent="blah blah ";
Comments
Post a Comment