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

Popular posts from this blog

resizing Telegram inline keyboard -

command line - How can a Python program background itself? -

php - "cURL error 28: Resolving timed out" on Wordpress on Azure App Service on Linux -