Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2

Thread: Simple jQuery

  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    81
    Thanks
    7
    Thanked 0 Times in 0 Posts

    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.

  • #2
    The fat guy next door VIPStephan's Avatar
    Join Date
    Jan 2006
    Location
    Halle (Saale), Germany
    Posts
    8,606
    Thanks
    6
    Thanked 997 Times in 970 Posts
    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(); 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •