jQuery Tutorial Tutorials - jQuery .first() method

jQuery .first() method

The .first() method in jQuery is used to filter the set of matched elements, keeping only the first one.

jQuery .first() method Syntax

.first()

jQuery .first() method Example

example

Highlight the first item

$('li').first().css('background','cyan');

Try now

Date:2019-08-26 13:36:47 From:www.Lautturi.com author:Lautturi