anevins Posted July 17, 2012 Share Posted July 17, 2012 Hello, I have four <ul>s with multiple <li>s, I just want to add a class 'last' to the last <li> within all the <ul>s. I've tried this $('footer ul').each(function(){ $('li').last().addClass('last'); }); But that only applies to the last <ul> Any idea what's going on here? Link to comment https://forums.phpfreaks.com/topic/265848-jquery-last-not-working/ Share on other sites More sharing options...
anevins Posted July 17, 2012 Author Share Posted July 17, 2012 SOLVED $('footer ul li:last-child').addClass('last'); Link to comment https://forums.phpfreaks.com/topic/265848-jquery-last-not-working/#findComment-1362236 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.