Detect last div with class name x and add to it a new class y

DagsEsselay

New Member
I would like to find out, which is the best way to determine the last div and add a new class to it. Is it javascript or css3?So here is my example. Let's say I have this: \[code\]<div class="items"> <div class="raw">item 1</div> <div class="raw">item 2</div> <div class="raw">item 3</div> <div class="raw">item 4</div> <div class="raw">item 5</div> <div class="raw">item 6</div></div>\[/code\]How? What method? I can add to the last div with class name "raw" a new class name "new"?so that it will become:\[code\]<div class="raw new">item 6</div>\[/code\]
 
Back
Top