开发者

help with jquery selector

开发者 https://www.devze.com 2023-01-15 00:08 出处:网络
i have this html block: <p><strong>this is the title</strong>this is the content</p>

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

精彩评论

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