I have some code in the format below that’s repeated throughout my page:
<div class="video-description-secondary" style="display:block;">
<h2 class="two">
Some title text
</h2>
<br/>
Some description text
</div>
Here’s the problem I’m running into: I want to retrieve the description text (after the br tag and before the closing div tag) using a jquery selector. I’m not sure how to write the proper jquery selector in order to retrieve that text since the text itself is not inside it’s own tag. I need to apply some code against that text so that I can properly implement a read more/less link.
Any help would be great.
Would something like this work for you? Technically it grabs everything not inside child tags as opposed to whatever is after break.
http://jsfiddle.net/aMKuY/2/
Alternate Solution
This gives you slightly more control over what is returned. Retrieve all text nodes and then grab last one.
http://jsfiddle.net/aMKuY/3/