jQuery wrapInner()
jQuery wrapInner()
is a built-in method that allows you to wrap an HTML structure around the content of an element.
Syntax
$().wrapInner(wrapper)
The wrapper
parameter in the above syntax can be a string of HTML elements, a jQuery object, or a function that generates HTML content.
Use
JQuery wrapInner()
is useful for adding additional HTML structure around the existing content of an element. This can be useful for formatting and styling text or adding additional elements such as buttons or links.
Example
Here is an example of how to use jQuery wrapInner()
to add a wrapper element around the content of a div
: