jQuery append() 方法
jQuery 教程
· 2019-03-27 11:27:52
实例
在所有 <p> 元素结尾插入内容:
$(document).ready(function(){
$("#btn1").click(function(){
$("p").append(" <b>插入文本</b>.");
});
$("#btn2").click(function(){
$("ol").append("<li>插入项</li>");
});
});
定义和用法
append() 方法在被选元素的结尾插入指定内容。
提示:如需在被选元素的开头插入内容,请使用 prepend() 方法。
语法
$(selector).append(content,function(index,html))
| 参数 | 描述 |
|---|---|
| content | 必需。规定要插入的内容(可包含 HTML 标签)。
可能的值:
|
| function(index,html) | 可选。规定返回待插入内容的函数。
|
点击查看所有 jQuery 教程 文章: https://codercto.com/courses/l/35.html
Web ReDesign 2.0
Kelly Goto、Emily Cotler / Peachpit Press / 2004-12-10 / USD 45.00
If anything, this volume's premise--that the business of Web design is one of constant change-has only proven truer over time. So much so, in fact, that the 12-month design cycles cited in the last ed......一起来看看 《Web ReDesign 2.0》 这本书的介绍吧!