Home  >  Article  >  Web Front-end  >  What does wrap mean in JavaScript?

What does wrap mean in JavaScript?

WBOY
WBOYOriginal
2021-12-28 18:36:434851browse

wrap in JavaScript means "wrapping". The wrap() method is used to wrap each selected element with the specified HTML element. The syntax is "element object.wrap(wrappingElement, function(index))" .

What does wrap mean in JavaScript?

The operating environment of this tutorial: Windows 10 system, JavaScript version 1.8.5, Dell G3 computer.

What does wrap mean in JavaScript

The wrap() method uses the specified HTML element to wrap each selected element.

The syntax is:

$(selector).wrap(wrappingElement,function(index))

The wrappingElement is required and is used to specify the HTML element that wraps each selected element, which may be an HTML element, a jQuery object or a DOM element.

function(index) is optional and is used to specify the function that returns the wrapped element.

The example is as follows:




123




这是一个段落。

这是另一个段落。

Output result:

What does wrap mean in JavaScript?

##[Related recommendations:

javascript learning tutorial

The above is the detailed content of What does wrap mean in JavaScript?. 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