I have the 1 button and some text in my HTML like the following:
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>
When the user clicks the button, the content in the <p id='txt'>
will become the follow expected result:
<p id='txt'>
// All the HTML element within the <p> will be disappear
I am working in ABC company.
</p>
Can anyone help me how to write the JavaScript function?
Thank you.
Question&Answers:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…