定义和用法
append() 方法在被选元素的结尾(仍然在内部)插入指定内容。
语法
$(selector).append(content)
使用函数来附加内容
使用函数在指定元素的结尾插入内容。
语法
$(selector).append(function(index,html))
参数 | 描述 |
---|---|
function(index,html) | 必需。规定返回待插入内容的函数。
|
$("button").click(function(){
$("p").append(" <b>Hello world!</b>")
;
});