toLast()

A Sniper method that moves an HTML element to the last position among its siblings in the parent element.

The toLast() function moves a specified HTML element to the last position among its sibling elements within the same parent.

Usage

$('selector').toLast();
  • selector: The element to be moved.

Example

Move the 1st list item to the end of its list:

$('ul li:nth-first').toLast();

Returns

  • The moved element.

Description

By calling toLast() on an element, the element is relocated to the end of its parent container, maintaining the DOM hierarchy smoothly.

Last updated