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
-
2020-12-13 14:12
$('div#test div:last-child');
-
2020-12-13 14:21
You can use the :last pseudo-selector:
$('#test div.a:last')
-
2020-12-13 14:34
Without jQuery:
var divs = document.getElementById("test").getElementsByTagName("div");
var lastChild = divs[divs.length - 1];