tags:

views:

43

answers:

3

how can i get the last div with class a in a div the id = test ? in this case i have to get the div with content = 1000

<div id="test">
<div class="a">1</div>
..
..
<div class="a>1000</div>
</div>
+4  A: 

$('div#test div.a:last')

Tom
A: 

$('div#test div:last-child');

Reigel
A: 

Without jQuery:

var divs = document.getElementById("test").getElementsByTagName("div");
var lastChild = divs[divs.length - 1];
Joel Alejandro