www.pokeroconnor.com

jQuery Access Last Element

May1

Just a quick one, if you want to manipulate the last instance of an element (or any element) on a page, you can do this SO easily and quickly with jQuery.

$(function() {
	  $("dt:last").addClass("last");
	});

This (obviously!) adds the class ‘last’ to the final dt element in the document. The cool thing is you could use $(”dt:last-1″) to access the second dt element, so flexible and easy to use…

posted under jQuery & JS

Email will not be published

Website example

Your Comment: