How do I select the last element with a specified class from descendants of this?

I have a <div> with many <ul> descendants with different classes, and I am calling a function on this <div> which modifies the last <ul> with a given class. How do I select the last <ul> descendant with a specified class using $(this) jQuery selector?


You can use the last method:

var last = $(this).find("ul.someClass").last();

Or the :last selector:

var last = $(this).find("ul.someClass:last");

Need Your Help

How to perform a 'merge' using clearcase?

java merge clearcase

I have been working on branch X and I need to move my code to branch Y. All my code are new classes that I started, so no one else has been working/modified my code, this also does not exist in the

What's the quickest way to pull up Vim's quickref page?

vim key-bindings

What is the simple key combination in Vim to bring up the quickref page, or at least a page that is functionally similar i.e. it contains a list of commands and their key bindings?

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.