after
UK[ˈɑ:ftə(r)] US[ˈæftə(r)]
prep.…after; (indicates time) in… Later; (indicating position and order) after...
conj.After...
adv.After, following
adj.Later, later
jquery after() method syntax
Function: after() method inserts the specified content after the selected element.
Syntax: $(selector).after(content
Parameters:
Parameter | Description |
content | Required. Specifies the content to be inserted (can include HTML tags). |
Syntax: Use the function to insert the specified content after the selected element.
Parameters: $(selector ).after(function(index))
Comment:
Parameter | Description |
function(index) | Required. Specifies the function that returns the content to be inserted. |
index | Optional. Receives the index position of the selector. |
jquery after() method example
<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>
Click the "Run instance" button to view the online instance