:first Selector

Selects the first matched DOM element.


As of jQuery 3.4, the :first pseudo-class is deprecated. Remove it from your selectors and filter the results later using .first().

The :first pseudo-class is equivalent to :eq( 0 ). It could also be written as :lt( 1 ). While this matches only a single element, :first-child can match more than one: One for each parent.

Finds the first table row.

    <td>Row 1</td>
    <td>Row 2</td>
    <td>Row 3</td>
td {
  color: blue;
  font-weight: bold;
$("tr:first").css("font-style", "italic");

Looking for a Web Developer?


Hi! I'm Basti, author of this site. If you are looking for a web developer with 15+ years of experience, holla at me!

Be it the good 'ol jQuery, vanilla JS or modern frameworks like Vue and Svelte, front- or backend, I can help you.

Just write me at jobs@jqapi.com :)