.append()
.append( content [, content ] )
- 返回: domtify
插入到元素内部的末尾(最后一个子元素)。
.append( content [, content ] ) from @1.0
- content
- 类型: htmlString|Element|Text|Array|domtify
- 描述: DOM 元素、文本节点、元素和文本节点数组、HTML 字符串或 jQuery 对象,插入到匹配元素集的每个元素的末尾。
- content
- 类型: htmlString|Element|Text|Array|domtify
- 描述: 一个或多个DOM 元素、文本节点、元素和文本节点数组、HTML 字符串或 jQuery 对象,插入到匹配元素集的每个元素的末尾。
.append( function ) from @1.0
- function
该.append()
方法将指定的内容插入为 domtify 集合中每个元素的最后一个子元素。
想象以下html片段:
html
<h2>Greetings</h2>
<div class="container">
<div class="inner">Hello</div>
<div class="inner">Goodbye</div>
</div>
您可以创建内容并将其一次插入到多个元素中:
js
d(".inner").append("<p>Test</p>")
每个内部<div>
元素都会获得以下新内容:
html
<h2>Greetings</h2>
<div class="container">
<div class="inner">
Hello
<p>Test</p>
</div>
<div class="inner">
Goodbye
<p>Test</p>
</div>
</div>