68
jQuery wrapInner()
The jQuery wrapInner() method is used to wrap an HTML structure around the content of each element in the set of matched element. This method can accept any string or object that could be passed to the $() factory function.
Syntax:
Parameters of jQuery wrapInner() method
Parameter | Description |
---|---|
wrappingElement | It is a mandatory parameter. It specifies what HTML elements are to be wrapped around the content of each selected element. Its possible values are:
|
Function(index) | It is an optional parameter. It specifies a function that returns the wrapping element.
|
Example of jQuery wrapInner() method
Let’s take an example to demonstrate the jQuery wrapInner() method.
You can also use more than one element to wrap the specified content.
jQuery wrapInner() example 2
In the above example we have used three tags altogether:
- emphasized <em>…</em> tag
- bold <b>…</b> tag
- <marquee>…</marquee> tag
jQuery wrapInner() example 3
Next TopicjQuery focus()