Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 09-16-2012, 07:56 AM   PM User | #1
johnsmith153
New Coder

 
Join Date: Mar 2012
Posts: 81
Thanks: 7
Thanked 0 Times in 0 Posts
johnsmith153 is infamous around these parts
Simple jQuery

I can't seem to do this anywhere.

I have this:

Code:
<div id="div-one">
//various rubbish inside
</div>

<div id="div-two>
//various rubbish inside
</div>
And I need jQuery to edit the HTML so that it results in this:

Code:
<div id="div-one">
//various rubbish inside
//various rubbish inside
</div>
I can't seem to do it. I've looked at before, after, insertBefore etc. but it doesn't work.
johnsmith153 is offline   Reply With Quote
Old 09-16-2012, 10:22 AM   PM User | #2
VIPStephan
The fat guy next door


 
VIPStephan's Avatar
 
Join Date: Jan 2006
Location: Halle (Saale), Germany
Posts: 7,592
Thanks: 5
Thanked 865 Times in 842 Posts
VIPStephan is a jewel in the roughVIPStephan is a jewel in the roughVIPStephan is a jewel in the rough
What exactly have you tried?
Try
PHP Code:
$('#div-two').contents().appendTo('#div-one').end().remove(); 
or
PHP Code:
$('#div-two').appendTo('#div-one').contents().unwrap(); 
__________________
Don’t click this link!
VIPStephan is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 09:16 AM.


Advertisement
Log in to turn off these ads.