help with jquery selector
i have this html block:
<p><strong>this is the title</strong>this is the content</p>
how开发者_开发百科 do i get only the "this is the content" string with jQuery?
thank you :)
Try this: http://jsfiddle.net/mTn7G/
var text = $('p').contents().last().text();
The .contents()
method gets all child elements, including text nodes, while .last()
will give you the last one, and .text()
will return its text content.
精彩评论