亚洲区国产区激情区无码区,国产成人mv视频在线观看,国产A毛片AAAAAA,亚洲精品国产首次亮相在线

jQuery after() 方法

jQuery HTML/CSS 方法

after()方法在所選元素之后插入指定的內(nèi)容。

要在選定元素之前插入內(nèi)容,請使用before()方法。

語法:

插入內(nèi)容:

$(selector).after(content)

使用函數(shù)插入內(nèi)容:

$(selector).after(function(index))

實例

在每個段落之后插入內(nèi)容:

$("button").click(function(){
  $("p").after("<p>Hello world</p>");
});
測試看看?/?

使用函數(shù)插入內(nèi)容:

$("button").click(function(){
  $("p").after(function(i){
    return "<p>這個p元素的索引: " + i + ".</p>";
  });
});
測試看看?/?

參數(shù)值

參數(shù)描述
content指定要在每個選定元素之后插入的內(nèi)容(可以包含HTML標簽)

可能的值:

  • HTML元素

  • DOM元素

  • jQuery對象

function(index)指定一個函數(shù),該函數(shù)返回要插入的內(nèi)容
  • index-返回元素在集合中的索引位置

jQuery HTML/CSS 方法