function firstLast()  
{  
  $('ul li:first-child').addClass('first');  
  $('ul li:last-child').addClass('last');  
}
jQuery(firstLast);