after
英 [?ɑ:ft?(r)]? ?美 [??ft?(r)]??
prep.…后的;(表示時間)在…以后;(表示位置、順序)在…后面
conj.在…以后
adv.以后,繼后
adj.后來的,以后的
jquery after()方法 語法
作用:after() 方法在被選元素后插入指定的內(nèi)容。
語法:$(selector).after(content
參數(shù):
參數(shù) | 描述 |
content? ?? | 必需。規(guī)定要插入的內(nèi)容(可包含 HTML 標簽)。 |
語法:使用函數(shù)在被選元素之后插入指定的內(nèi)容。
參數(shù):$(selector).after(function(index))
注釋:
參數(shù) | 描述 |
function(index) | 必需。規(guī)定返回待插入內(nèi)容的函數(shù)。 |
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 元素后插入內(nèi)容</button> </body> </html>
點擊 "運行實例" 按鈕查看在線實例