Jump to content

jQuery last() Not Working


anevins

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.