YumJS Append and Prepend Documentation

Append and Prepend


Yum's append() and prepend() allow you to append, strings, elements and nodes to collections.


Append


// Append a string to all classes or collections

yum('.blurb').append('STRING APPENDED'); 



// Append a HTML from string to all classes or collections

yum('.blurb').append('<span>APPEND HTML</span>'); 



// Same as above with collection as variable

const blurb = yum('.blurb')._;
yum(blurb).append('<span>APPEND NODE</span>');


// Append using singular node references

yum(node1).append(node2'); 



// yums can be nested - yum yum :)

yum(yum('h2').first).append(yum('.blurb').first); 


Prepend


// Prepend a string to all classes or collections

yum('.blurb').prepend('STRING PREPENDED'); 



// Prepend a HTML from string to all classes or collections

yum('.blurb').prepend('<span>PREPEND HTML</span>'); 



// Same as above with collection as variable

const blurb = yum('.blurb')._;
yum(blurb).prepend('<span>PREPEND NODE</span>');


// Prepend using singular node references

yum(node1).prepend(node2'); 



// yums can be nested - yum yum :)

yum(yum('h2').first).prepend(yum('.blurb').first); 


Questions please contact me.