How do I change the text of a span element using JavaScript?

后端 未结 13 647
悲&欢浪女
悲&欢浪女 2020-11-22 09:21

If I have a span, say:

 hereismytext 

How do I use JavaScript to change "hereism

相关标签:
13条回答
  • 2020-11-22 10:03
    document.getElementById("myspan").textContent="newtext";
    

    this will select dom-node with id myspan and change it text content to new text

    0 讨论(0)
提交回复
热议问题