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? Quote 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'); Quote Link to comment https://forums.phpfreaks.com/topic/265848-jquery-last-not-working/#findComment-1362236 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.