How to use the SiteGainer ”sg_change” library

[THIS FEATURE IS IN CLOSED BETA – PLEASE CONTACT SUPPORT IF YOU WANT TO USE IT]


// Change text of element

sg_change({
	'element':'h1.productName',
	'type':'text',
	'value':'Jelly Beans 12 pack'
});

//Change HTML of element

sg_change({
	'element':'h1.productName',
	'type':'html',
	'value':'<p>Jelly Beans 12 pack</p>'
});

// Add an HTML element inside or before / after an element

sg_change({
	'element':'body', // The targeted element
	'type':'prepend', // How the code will be inserted. 'Append' / 'prepend' / 'before' / 'after' can be used.
	'value':'<div style="color:red">My special div</div>' // The HTML / text that will be inserted.
});

// Change the HTML of an element to the HTML content of another element

sg_change({
	'element':'body',
	'type':'html',
	'node':'h1.myElement'
});