YouTip LogoYouTip

Html Wrap

# jQuery wrap() Method ## jQuery wrap() Method **jQuery HTML manipulation method** **Definition and Usage** The wrap() method wraps specified HTML element(s) around each selected element. **Syntax** ```javascript $(selector).wrap(wrapper) | Parameter | Description | |---|---| | *wrapper* | Required. Specifies what HTML element(s) to wrap around the selected elements. Possible values: HTML elements, jQuery objects, or DOM elements | --- ## jQuery unwrap() Method **jQuery HTML manipulation method** **Definition and Usage** The unwrap() method removes the parent element of the selected elements. This method removes the immediate parent element. **Syntax** ```javascript $(selector).unwrap() --- ## jQuery wrapAll() Method **jQuery HTML manipulation method** **Definition and Usage** The wrapAll() method wraps specified HTML element(s) around all selected elements. **Syntax** ```javascript $(selector).wrapAll(wrapper) | Parameter | Description | |---|---| | *wrapper* | Required. Specifies what HTML element(s) to wrap around all selected elements. Possible values: HTML elements, jQuery objects, or DOM elements | --- ## jQuery wrapInner() Method **jQuery HTML manipulation method** **Definition and Usage** The wrapInner() method wraps specified HTML element(s) around the content (inner HTML) of each selected element. **Syntax** ```javascript $(selector).wrapInner(wrapper) | Parameter | Description | |---|---| | *wrapper* | Required. Specifies what HTML element(s) to wrap around the content of each selected element. Possible values: HTML elements, jQuery objects, or DOM elements | --- ## More Examples ### Example Wrap a `` element around each paragraph: ```javascript $("button").click(function(){ $("p").wrap(""); }); ### Example Wrap a `
` element with class "container" around each paragraph: ```javascript $("button").click(function(){ $("p").wrap("
"); }); ### Example Wrap a jQuery object around the content of each paragraph: ```javascript $("button").click(function(){ $("p").wrapInner(""); }); --- ## Online Examples [Try it yourself Β»](#) --- ## Related Pages jQuery tutorial: (/jquery/jquery-dom-add.html "jQuery - Add elements") --- ## Color Schemes Background: Light Dark --- ## Exercise: Test your skills with exercises! (#) --- ## Kickstart your career Start learning now! [Get Certified Β»](#) --- **Note:** This content is based on the original tutorial from . For the most up-to-date information, please visit the (#). Content published under [CC BY 3.0](http://creativecommons.org/licenses/by/3.0/) Β© Copyright 2012 - 2025 (javascript:void(0);) (/report-bug.html?url=http%3a%2f%2fwww.%2fjquery%2fhtml-wrap.html) (javascript:void(0);)
← Html WrapallCss Width β†’

YouTip © 2024-2026 | Home | Learn Technology, Build Dreams!

All content is for educational and learning purposes only.