By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,364 Members | 1,341 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,364 IT Pros & Developers. It's quick & easy.

get text from dom element

P: n/a
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
Nov 6 '08 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Andrew Poulos wrote:
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
Nov 6 '08 #2

This discussion thread is closed

Replies have been disabled for this discussion.