我的 HTML 中有 1 按钮和一些文本,如下所示:
function get_content(){
// I don't know how to do in here!!!
}
<input type="button" onclick="get_content()" value="Get Content"/>
<p id='txt'>
<span class="A">I am</span>
<span class="B">working in </span>
<span class="C">ABC company.</span>
</p>
当用户点击按钮时, 中的内容<p id='txt'>
会变成如下预期的结果:
<p id='txt'>
// All the HTML element within the <p> will be disappear
I am working in ABC company.
</p>
谁能帮助我如何编写 JavaScript 函数?
谢谢你。