domy-insert

Insert any data type to the DOM

domy-insert

Insert any data type to the DOM. For use with Browserify.

Part of the Domy module collection.

npm install domy-insert --save
var insert = require('domy-insert');
 
insert('<div class="item"></div>');
insert.before('<div class="before-item"></div>', '.item');
 
var div = document.createElement('div');
div.className = 'another-element';
 
insert(div, '.parent');
  • element - string OR DOM element to insert
  • parent - string OR DOM element to insert the element to. Defaults to document.body
  • element - string OR DOM element to insert
  • sibling - string or object of element to insert before
  • parent - string or DOM element of context of insert. Defaults to document.body
  • element - string OR DOM element to insert
  • sibling - string or object of element to insert after
  • parent - string or DOM element of context of insert. Defaults to document.body
npm install
npm test