JavaScript Append

append html using javascript

by manoj_antony32

JavaScript

var elm = '<p>hello</p>';
//If the parent document doesn't have JQuery:
elm.appendTo(parent.document.body);

$('<p>world</p>').appendTo(parent.$('#DesktopPlatformBar'))

//Only if JQuery is included at the parent
elm.appendTo(parent.$("#wrap"));
parent.$("#wrap").append(elm);

// If JQuery is defined at the frame AND the parent (current document)
$("#wrap").append(frames[0].$("#elm"));
frames[0].$("#elm").appendTo($("#wrap"));

elm.click(function(){
    parent.$("#wrap").append(this);
});

$("#wrap").append($("iframe #myElement"));