开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜