Home>Article>Web Front-end> What does wrap mean in JavaScript?
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))" .
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:
##[Related recommendations: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!