jQuery after () method
Examples
Insert content after each <p> element:
$("button").click(function(){
$("p").after("<p>Hello world!</p>");
});
$("p").after("<p>Hello world!</p>");
});
try it"
Definition and Usage
after () method to insert the specified content in the selected elements.
Tip: To insert content before the selected element, use before () method.
grammar
$(selector).after(content,function(index))
参数 | 描述 |
---|---|
content | 必需。规定要插入的内容(可包含 HTML 标签)。
可能的值:
|
function(index) | 规定返回待插入内容的函数。
|
More examples
after () - Create content via HTML, jQuery and DOM
() Method to insert content through after.
Use function Inserts
How to use the function after being selected element insertions.