Home  >  Article  >  Web Front-end  >  How to use jquery's after method

How to use jquery's after method

little bottle
little bottleOriginal
2019-05-31 16:37:473160browse

jquery is a fast and concise JavaScript framework. It is another excellent JavaScript code library after Prototype. The purpose of jquery's design is "write less, do more", which means writing less code and doing more things. Now I will show you how to use jQuery’s after method?

How to use jquery's after method

after() method inserts the specified content after the selected element. If you need to insert content before the selected element, please use the before() method.

jquery video tutorial

Grammar

$(selector).after(content,function(index))
Parameters
Description
content
Required. Specifies the content to be inserted (can include HTML tags).
function(index)
Specifies the function that returns the content to be inserted. index - Returns the index position of the element in the collection.

Give me an example:

$("button").click(function(){

    $("p").after("<p>Hello world!</p>");
});

The above is the detailed content of How to use jquery's after method. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn