_scripts/modules.js
// create an element and append it to another
create an element and append it to another
create an element and append it to another
function CreateAndAppend(child, parent, callback) {
	this.child = CreateElem(child);
	if(typeof(parant) === 'string') {
		this.parent = Select(parent);
	} else if(!parent) {
		print('error parent argument not defined')
		return
	} else {
		this.parent = parent;
	}
	this.parent.appendChild(this.child)
	callback(this.child)
}
function CreateAndAppend ( child , parent , callback ) { this . child = CreateElem ( child ) ; if ( typeof ( parant ) === 'string' ) { this . parent = Select ( parent ) ; } else if ( ! parent ) { print ( 'error parent argument not defined' ) return } else { this . parent = parent ; } this . parent . appendChild ( this . child ) callback ( this . child ) }
create an element and append it to another
create an element and append it to another
// create an element here // checks if argument passed to parent parameter is a string // if argument is a string then select it // this allows css selectors in the parent parameter // if argument passed to parent parameter is a DOM Element // assign it to this.parent // callback function allows for you to manipulate the // the element that was created