jQuery API 返回首页目录 | jQuery API 中英文对照版
html(val)
html(val)

设置每一个匹配元素的html内容。这个函数不能用于XML文档。

返回值:jQuery

参数:

  • val (String): Set the html contents to the specified value.
 
示例:

$("div").html("<b>new stuff</b>");

HTML 代码:

<div><input/></div>

结果:

<div><b>new stuff</b></div>

 
html( val )

Set the html contents of every matched element. This property is not available on XML documents (although it will work for XHTML documents).

Return value: jQuery
Parameters:

  • val (String): Set the html contents to the specified value.
 

Example:

 $("div").html("<b>new stuff</b>");  
Before:
 <div><input/></div>  
Result:
 <div><b>new stuff</b></div>  
相关链接
asp之家 | jQuery官方网站 | jQuery中文网 | 电子书作者网站 | 电子书作者blog