YumJS Text and HTML Documentation

Text and HTML


Yum's text() and html() methods allow you to get or set the text and HTML of a collection.


Get the Text or HTML

When used with no parameters, these methods return the text or html of the entire collection. Pass in a singular node reference to get the text/html of that one node.


// Get the text of all elements with class .blurb into a variable

const txt = yum('.blurb').text(); 
console.log(txt);



// Get the html

const htm = yum('.blurb').html(); 
console.log(htm);



Set the Text or HTML

Pass in strings or HTML to set the text() or html().


// Set the text

yum('.blurb').text('I AM NEW TEXT'); 



// Set the html

yum('.blurb').html('<span>I AM NEW HTML</span>'); 



Questions please contact me.