We're a community of 1076K IT Pros here for help, advice, solutions, professional growth and fun. Join us!
1,075,695 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Start New Discussion Reply to this Discussion

Get only elements with text inside

Hi,

I want to get all the elements (span, paragraphs, div, etc.) that hold text inside, but just text.

e.g.: If I had :

<p>this is a paragraph</p>
<p><div>this is a paragraph with a div inside</div></p>
<div>this is a div</div>
<span>this is a span <span>with a span</span>inside</span>

So I would get just:

 <p>this is a paragraph</p>
 <div>this is a div</div>

Only the element with no html tags inside.

Thanks,

Regards

2
Contributors
1
Reply
32 Minutes
Discussion Span
9 Months Ago
Last Updated
2
Views
softDeveloper
Junior Poster in Training
76 posts since Nov 2011
Reputation Points: 10
Solved Threads: 0
Skill Endorsements: 0

If you are comfortable with jQuery, then jquery filter() can be implemented easily.

ko ko
Practically a Master Poster
673 posts since Jan 2009
Reputation Points: 120
Solved Threads: 152
Skill Endorsements: 1

This article has been dead for over three months: Start a new discussion instead

Post: Markdown Syntax: Formatting Help
 
You
 
© 2013 DaniWeb® LLC
Page rendered in 0.1243 seconds using 2.67MB