Last active
August 29, 2015 14:02
-
-
Save hkfoster/3245eddd3f4867a5ba6e to your computer and use it in GitHub Desktop.
Native JS Node Maker Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Node Maker Function | |
* @author Kyle Foster | |
*/ | |
var makeNode = function( parent, content ) { | |
var node = document.createElement( parent ); | |
if ( content ) node.innerHTML = content; | |
return node; | |
}; | |
// Create node w/ content | |
var text = makeNode( 'tr', '<td>Simple text</td>' ); | |
// Append to body | |
document.body.appendChild( text ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment