📜  jQuery after()

📅  最后修改于: 2020-11-25 11:39:21             🧑  作者: Mango

jQuery after()

jQuery after()方法用于在选定元素之后插入指定的内容。就像jQuery append()方法一样。

如果要在所选元素之前插入内容,则应使用jQuery的before()方法。

句法:

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

jQuery after()方法的参数

Parameter Description
Content It is a mandatory parameter. It specifies the content to insert.
Its possible values are:
  • HTML elements
  • jQuery objects
  • DOM elements
Function (index) It specifies a function that returns the content which is used to insert.
  • index: It provides the index position of the element in the set.

jQuery after()方法的示例

让我们看一下jQuery after()方法的示例:









This is a tutorial website.

This is a training institute.

输出:

This is a tutorial website.

This is a training institute.