First Child Selector Jquery Code Example


Example 1: firstElementChild jquery equivalent


$('#myList > li:first-child');
// or
$('#myList').children('li:first-child');
// or
$('#myList > li').first();
// or
$('#myList').children().first();
// and so on

Example 2: jquery first child


$('div:first-child')

Example 3: jquery first child


$( "li" ).first().css( "background-color", "red" );

Comments

Popular posts from this blog

Converting A String To Int In Groovy

"Cannot Create Cache Directory /home//.composer/cache/repo/https---packagist.org/, Or Directory Is Not Writable. Proceeding Without Cache"

Android How Can I Convert A String To A Editable