I would like to move one DIV element inside another. For example, I want to move this (including all children):
...
>
For the sake of completeness, there is another approach wrap()
or wrapAll()
mentioned in this article. So the OP's question could possibly be solved by this (that is, assuming the does not yet exist, the following approach will create such a wrapper from scratch - the OP was not clear about whether the wrapper already exists or not):
$("#source").wrap('')
// or
$(".source").wrapAll('')
It sounds promising. However, when I was trying to do $("[id^=row]").wrapAll("")
on multiple nested structure like this:
It correctly wraps those
and ...
BUT SOMEHOW LEAVES OUT the . So I ended up use the explicit
$("row1").append("#a_predefined_fieldset")
instead. So, YMMV.