jQuery: Append a CSS class to any item or last item

<script type="text/javascript">
	jQuery("p:last").addClass(" last");
</script>

It’s important to note that this method does not replace a class. It simply adds the class, appending it to any which may already be assigned to the elements.

More than one class may be added at a time, separated by a space, to the set of matched elements, like so:

$("p").addClass("myClass yourClass");

(more…)

Continue ReadingjQuery: Append a CSS class to any item or last item