ฉันมีปุ่ม 1 และข้อความบางส่วนใน HTML ของฉันดังต่อไปนี้:
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 ได้ไหม
ขอบคุณ.