how to embed the whole into a created new div with jQuery?

Posted in dotnet, vb, vb.net | No Comments »

I want to change files DOM from

<html>
    <body>i'm a body</body>
    <p>i'm out of body</p>
</html>

to

<html>
    <body>
        <div id='bodyContainer'>
            i'm a body
        </div>
        <div id='footer'>
            i'm a footer
        </div>
    </body>
    <p>i'm out of body</p>
</html>

I tried to make it happen by jQuery

$(document).ready(function() {
    $("body").append("<div id='container'>I'm a body-container</div>");
    $("body").append("<div id='footer'>i'm testing!</div>");
});

but failed, please see example http://jsfiddle.net/7szM4/2/
Thanks.

Similar:

  1. How to call javascript function on dynamically created html using jquery? Hi guys, I am developing an invoice project. I am calculating amount of each section and assigning in grand total. For multiple invoice body section,...
  2. Javascript jQuery only shows Image element once in IE. FF works I want to show a big Image when I press the small thumbnail. A simple Lightbox style script. When I press the grey transparent overlay...
  3. how to delete element created with jquery ?! hi , i have write this block of code in jquery to create three element after some events $('body').append( tmp= $('<div id="tmp"></div>') ); $('<div id="close"...
  4. Is there a ‘ready’ event fired when a jQuery element is created on the fly? I’m trying to implement something like a photo carousel in jQuery. This carousel could be filled with images using an array of image sources (I...
  5. Sort order of table tbody in same order as list elments jquery json I have been working on this jsFiddle and wanted to extend the functionality so that when the list items have been altered and submitted via...

Leave a Reply