我有一个span标签,里面有一些html代码可以创建一些角落和其他东西.现在使用javascript我想为它添加一些标题.约束是跨度的原始内容不应被覆盖.
例如
<span> <!-some more complicated html code </span>
Run Code Online (Sandbox Code Playgroud)
现在我想在span中添加标题,以便span看起来像
<span> NEW CAPTION <!-some more complicated html code </span>
Run Code Online (Sandbox Code Playgroud)
我该怎么做?
document.getElementById.innerHtml = "NEWCAPTION" + document.getElementById.innerHtml
Run Code Online (Sandbox Code Playgroud)
它是否正确?