Reputation: 5670
my html is like this
<div id="149708366" class="fav-list">
<em style="display:none"> </em>
</div>
and my jquery code to wrap this with a new div( $(data) reffers to above html)
alert( $(data).find(list).wrap('<div class="new" />').html());
and I am expecting below html as result
<div id="149708366" class="fav-list">
<em style="display:none"> </em>
</div>
but only gets this in jquery alert message
<em style="display:none"> </em>
can any one help me on this.
Upvotes: 0
Views: 1647
Reputation: 73906
Try this out
alert( $(data).find(list).wrap('<div class="new" />').parent().html());
Upvotes: 2
Reputation: 34895
wrap()
returns the original element, thus the output is correct.
This method returns the original set of elements for chaining purposes.
Upvotes: 1