Skip to content

Function: toBack()

ts
function toBack(el): void;

Moves the given element to the back of its parent's children.

Parameters

ParameterTypeDescription
elHTMLElementThe element to move to the back.

Returns

void

Example

ts
const parent = document.createElement('div')
const a = document.createElement('span')
const b = document.createElement('span')
parent.appendChild(a)
parent.appendChild(b)
toBack(a)
console.log(parent.lastElementChild === a)

Since

1.0.0

Released under the MIT License.