Skip to main content

Bug Tracker

Side navigation

#10926 closed bug (invalid)

Opened November 30, 2011 09:56AM UTC

Closed November 30, 2011 01:39PM UTC

Last modified November 30, 2011 02:24PM UTC

Wrap function doesn't wrap jQuery objects unless added to DOM

Reported by: Owned by:
Priority: low Milestone: None
Component: manipulation Version: 1.6.4
Keywords: Cc:
Blocked by: Blocking:

Hi there,

It seems there is a dependency in wrap function which works correctly only if selector points to existing DOM element and doesn't produce anything if selector is a jQuery object which is not yet added to DOM. jsFiddle share ( describes my problem better.

I hope team can advice why it so and is there someway around this. Couldn't it just work without element added to DOM?


Attachments (0)
Change History (2)

Changed November 30, 2011 01:39PM UTC by sindresorhus comment:1

component: unfiledmanipulation
priority: undecidedlow
resolution: → invalid
status: newclosed

Not a bug, .wrap()returns the original set. From the docs:

This method returns the original set of elements for chaining purposes.

For what you're trying to do, you'll need to add .parent() like this:


Changed November 30, 2011 02:24PM UTC by comment:2

This is to confirm that given solution works for me. Thanks for the help.