html() 取得第一个匹配元素的html内容。这个函数不能用于XML文档。但可以用于XHTML文档。 Get the html contents of the first matched element. This property is not available on XML documents (although it will work for XHTML documents). 返回值 String 示例 代码如下: HTML 代码: Hello jQuery 代码: $(“div
text()
取得所有匹配元素的内容。
结果是由所有匹配元素包含的文本内容组合起来的文本。这个方法对HTML和XML文档都有效。
Get the text contents of all matched elements.
The result is a string that contains the combined text contents of all matched elements. This method works on both HTML and XML documents.