hi! 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 :)
hi! 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.