You almost had it :). There's a handy function called "wrap" that you can use.
$('div.box').children('span.heading').wrap('<table><tr><td></td></tr></table>');
More documentation here:
http://docs.jquery.com/DOM/Manipulation#wrap.28_elem_.29
Karl Rudd
On 2/13/07, Agrawal, Ritesh <[EMAIL PROTECTED]> wrote:
>
> Hi,
>
> I have been using jquery for some time but never really created my own
> extension that requires dom manipulation. I am wondering how can I wrap a
> <span> with two table element. So my original code is something like this
>
> Original
> <div class="box">
> <span class="heading">Heading</span>
> </div>
>
> Modified (desired result)
> <div class="box">
> <table>
> <tr>
> <td><span>heading</span></td>
> </tr>
> </table>
> </div>
>
> I was able to get handle on div.box but when I tried
> $('div.box').children("span.heading").before('...').after('...'); that
> didn't worked..
>
> Regards,
> Ritesh
> --
> View this message in context:
> http://www.nabble.com/Newbie-Question---wraping-an-element-tf3219302.html#a8940360
> Sent from the JQuery mailing list archive at Nabble.com.
>
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/