Alex Rivera | Logout

How to get only direct text without tags with jQuery in HTML

Asked 2011-12-24T12:43:13.163
44

I've got an HTML:

<strong>1)</strong>TEXT THAT I ONLY NEED<p>some par</p><ul>..</ul>

I need only "TEXT THAT I ONLY NEED" that is not withing any tags in his HTML, how can I get it with jQuery?

Edit
Report

1 Answer

-3

Your markup isn't the greatest for this. If you wrapped the text you want with a span such as:

<span class="gettext">TEXT THAT I NEED</span>

You could use $('.gettext').text(); in jQuery.

answered 2011-12-24T12:47:49.580

Your Answer