This repository was archived by the owner on Mar 2, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Inserting Content
dev-nicolaos edited this page Apr 11, 2019
·
2 revisions
FSLDOM provides four functions for inserting content into the DOM.
before()prepend()append()after()
These functions are built on top of element.insertAdjacentElement and element.insertAdjacentHTML and correspond to the position values 'beforebegin', 'afterbegin', 'beforeend', and 'afterend' respectively.
fD.insertionFunction(target, newContent)
- { HTMLElement OR string } target - The element relative to which the new content will be placed, or selector string that can be used in
document.querySelector()to retrieve said element. - { HTMLElement OR string } newContent - The content to be added, either an HTML Element or a string of HTML
Returns a Boolean value indicating whether or not the content was successfully injected.
fD.append(myList, '<li>Yet another item</li>'); fD.after('#site-header', bannerElement); if (fD.before(myMap, myLegend)) {
// Do some logic
}