Home >>jQuery Tutorial >jQuery wrapInner() Method

jQuery wrapInner() Method

jQuery wrapInner() Method

jQuery wrapInner() method in jQuery is used to wraps specified HTML element around the content of each selected element.


Parameter Values

Parameter Description
wrappingElement It is a required parameter and is used to Specifies what HTML element to wrap around the content

Possible values:

  • jQuery objects
  • HTML elements
  • DOM elements
function(index) It is optional and is used to returns the wrapping element of a function
  • index – It is used to returns the index position of the element
Here is an Example of jQuery wrapInner() Method:

<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<p class="txt1">This is First paragraph.</p>
<p class="txt1">This is Second paragraph.</p>
<button class="btn1">Click me to Wrap a content</button>


This is First paragraph.

This is Second paragraph.

No Sidebar ads