appending one object to another in javascript -


i have created 2 objects shown in below script. i'm able append them onto page using 'document.body'. now, wanted append 'appitem' header in 'mainwrapper'. how can this.

function mainwrapper() {     var wrapper;     var header;      function create() {         wrapper = document.createelement('div');         header = document.createelement('div');         wrapper.appendchild(header);     }      function style() {         wrapper.classname = "wrapper";         header.classname = "header";     }      function init() {         create();         style();     }     init();     this.render = function (k) {         k.appendchild(wrapper);     } }  function appitem() {     var appitemicon;     appitemicon = document.createelement('img');     appitemicon.src = 'icons/list.png';     this.appitemrender = function (k) {         k.appendchild(appitemicon);     } } window.addeventlistener('load', onload);  function onload() {     var main = new mainwrapper();     var applist = new appitem();     main.render(document.body);     applist.appitemrender(document.body); } 


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

Rendering JButton to get the JCheckBox behavior in a JTable by using images does not update my table -