after

英 [ˈɑ:ftə(r)]   美 [ˈæftə(r)]  

prep.…后的;(表示时间)在…以后;(表示位置、顺序)在…后面

conj.在…以后

adv.以后,继后

adj.后来的,以后的

jquery after()方法 语法

作用:after() 方法在被选元素后插入指定的内容。

语法:$(selector).after(content

参数:

参数描述
content    必需。规定要插入的内容(可包含 HTML 标签)。


语法:
使用函数在被选元素之后插入指定的内容。

参数:$(selector).after(function(index))

注释:

参数描述
function(index)必需。规定返回待插入内容的函数。
index 可选。接收选择器的 index 位置。

jquery after()方法 示例

<html>
<head>
<script type="text/javascript" src="http://apps.bdimg.com/libs/jquery/2.1.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
  $("button").click(function(){
    $("p").after("<p>Hello world!</p>");
  });
});
</script>
</head>
<body>
<p>This is a paragraph.</p>
<button>在每个 p 元素后插入内容</button>
</body>
</html>
运行实例 »

点击 "运行实例" 按钮查看在线实例

热门推荐