Created
          April 12, 2017 20:16 
        
      - 
      
- 
        Save the-architect/a86731021a4cfe491dbbb506fad51d44 to your computer and use it in GitHub Desktop. 
    ES6 Utility Class: Create a new element and attach it to another one
  
        
  
    
      This file contains hidden or 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
    
  
  
    
  | export const Utility = { | |
| createElement: function(tagName = 'DIV', className, appendTo) { | |
| let element = document.createElement(tagName); | |
| element.className = className; | |
| if(typeof appendTo !== 'undefined'){ | |
| appendTo.appendChild(element); | |
| } | |
| return element; | |
| } | |
| }; | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment