Skip to content

Function: toFront() ​

ts
function toFront(el): void;

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

Parameters ​

ParameterTypeDescription
elHTMLElementThe element to move to the front.

Returns ​

void

Example ​

ts
// Create a new element and add it to the DOM
const newDiv = document.createElement('div');
document.body.appendChild(newDiv);

// Move the new element to the front of the body
toFront(newDiv)

Since ​

1.0.0

Released under the MIT License.