Ho il pulsante 1 e del testo nel mio HTML come il seguente:
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>
Quando l'utente fa clic sul pulsante, il contenuto in <p id='txt'>diventerà il seguente risultato atteso:
<p id='txt'>
// All the HTML element within the <p> will be disappear
I am working in ABC company.
</p>
Qualcuno può aiutarmi a scrivere la funzione JavaScript?
Grazie.