jquery selector -


hi html code :

<ul>     <li>li 1</li>     <li>li 2</li>     <li>li 3</li>     <li>li 4</li>     <li>li 5</li> </ul> 

and jquery code :

$('ul li').each(function(index) {     if( index > 2 )     {         $(this).css('color','red');     } }); 

and jsfiddle link : http://jsfiddle.net/ylbcs/

i want know exist other way work without each function ?

you're looking :gt selector:

$('ul li:gt(2)').css('color','red'); 

Comments