SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Thread: Simple jQuery

Hybrid View

  1. #1
    SitePoint Addict
    Join Date
    Sep 2008
    Posts
    341
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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. #2
    Utopia, Inc. silver trophy
    ScallioXTX's Avatar
    Join Date
    Aug 2008
    Location
    The Netherlands
    Posts
    9,097
    Mentioned
    153 Post(s)
    Tagged
    2 Thread(s)
    Try this:

    Code javascript:
    $('#div-one').append($('#div-two').html());
    $('#div-two').remove();
    Rémon - Hosting Advisor

    SitePoint forums will switch to Discourse soon! Make sure you're ready for it!

    Minimal Bookmarks Tree
    My Google Chrome extension: browsing bookmarks made easy

  3. #3
    SitePoint Enthusiast
    Join Date
    Jul 2011
    Location
    Novi Sad
    Posts
    34
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ScallioXTX solved your problem!
    This is working example on JSBin: http://jsbin.com/imocav/1/edit


Bookmarks

Posting Permissions

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