get text from dom element

A

Andrew Poulos

Say there's a P HTML element that is known to contain text. Eg.

<p id="foo">This is some <span style="font-weight:bold;">sample</span>
text.</p>

How can I get just the text, without any tag names or attributes?

Andrew Poulos
 
A

Andrew Poulos

Andrew said:
Say there's a P HTML element that is known to contain text. Eg.

<p id="foo">This is some <span style="font-weight:bold;">sample</span>
text.</p>

How can I get just the text, without any tag names or attributes?

Sorry, I found it: "innerText" and "textContent".

Andrew Poulos
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top