2
我有这样的HTML块:帮助的jQuery选择
<p><strong>this is the title</strong>this is the content</p>
我怎么只有“这是内容”字符串使用jQuery?
谢谢:)
我有这样的HTML块:帮助的jQuery选择
<p><strong>this is the title</strong>this is the content</p>
我怎么只有“这是内容”字符串使用jQuery?
谢谢:)
试试这个:http://jsfiddle.net/mTn7G/
var text = $('p').contents().last().text();
的.contents()
方法获取所有子元素,包括文本节点,而.last()
会给你最后一个,和.text()
将返回其文字内容。
非常感谢您的帮助! – alon 2010-09-08 00:45:57