jquery after() method
Translation results:
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() methodsyntax
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() methodexample
<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
Popular Recommendations
- iPhone 16: Edit Photographic Styles After Shooting
- Ethena Labs Halts Website After Domain Hack
- BlockDAG Set For Significant Gains After Presale
- SOLVED - Laptop Charger Not Working After Power Surge
- BingX Restores Select Crypto Withdrawals After $52M Hack
- Catizen (CATI) Coin Skyrockets 1400% After Binance Listing