Latest web development tutorials

jQuery: last selector

jQuery selector jQuery selector

Examples

Select the last <p> element:

$("p:last")

try it"

Definition and Usage

: Last picker to select the last element.

Note: This option is only used to select a single element. Use : last-child selector to select multiple elements (each element of a parent).

The most common usage: used in conjunction with other selectors, select specific combinations of the last element (such as the above example).

Tip: To select specific combinations of the first element, use the : first selector.


grammar

$(":last")


Examples

Try - Example

: last-child between different: last and
Demo: different last-child choose between: last and.


jQuery selector jQuery selector